Exemplo n.º 1
0
 def check_no_default_route_thread():
     try:
         while True:
             time.sleep(60)
             try:
                 check_no_default_route()
             except OSError, e:
                 if e.errno != errno.ENOMEM:
                     raise
     except:
         utils.log_exception()
     finally:
         exit.kill_main(1)
Exemplo n.º 2
0
 def check_no_default_route_thread():
     try:
         while True:
             time.sleep(60)
             try:
                 check_no_default_route()
             except OSError, e:
                 if e.errno != errno.ENOMEM:
                     raise
     except:
         utils.log_exception()
     finally:
         exit.kill_main(1)
Exemplo n.º 3
0
                for s in select_list:
                    s(*args)
        finally:
            # XXX: We have a possible race condition if a signal is handled at
            #      the beginning of this clause, just before the following line.
            exit.acquire(0) # inhibit signals
            while cleanup:
                try:
                    cleanup.pop()()
                except:
                    pass
            exit.release()
    except ReexecException, e:
        logging.info(e)
    except Exception:
        utils.log_exception()
        sys.exit(1)
    try:
        sys.exitfunc()
    finally:
        os.execvp(sys.argv[0], sys.argv)

if __name__ == "__main__":
    try:
        main()
    except SystemExit, e:
        if type(e.code) is str:
            if hasattr(logging, 'trace'): # utils.setupLog called
                logging.critical(e.code)
        raise
Exemplo n.º 4
0
            if config.console:
                select_list.append(console.select)
            select_list += tunnel_manager.select, utils.select
            while True:
                args = R.copy(), {}, []
                for s in select_list:
                    s(*args)
        finally:
            # XXX: We have a possible race condition if a signal is handled at
            #      the beginning of this clause, just before the following line.
            exit.acquire(0)  # inhibit signals
            while cleanup:
                try:
                    cleanup.pop()()
                except:
                    pass
            exit.release()
    except ReexecException, e:
        logging.info(e)
    except Exception:
        utils.log_exception()
        sys.exit(1)
    try:
        sys.exitfunc()
    finally:
        os.execvp(sys.argv[0], sys.argv)


if __name__ == "__main__":
    main()