class Monitor(threading.Thread):
    def __init__(self, connection, stop_callback, active_callback):
        threading.Thread.__init__(self)
        self.setDaemon(True)
        self.connection = connection
        self.stop_callback = stop_callback
        self.active_callback = active_callback
        from nmlib.nm_remote_settings import ThreadVPNSpec
        self.td = ThreadVPNSpec(connection, self.on_active_conn_create)
        self.td.start()

    def on_active_conn_create(self, active_conn):
        #pass
        net_manager.emit_vpn_start(active_conn)
         
    def run(self):
        while self.td.isAlive():
            time.sleep(1)

        else:
            if self.td.succeed:
                #self.active_callback()
                pass
            else:
                #Dispatcher.emit('vpn-force-stop')
                #self.stop_callback()
                pass
        
        '''
示例#2
0
class Monitor(threading.Thread):
    def __init__(self, connection, stop_callback, active_callback):
        threading.Thread.__init__(self)
        self.setDaemon(True)
        self.connection = connection
        self.stop_callback = stop_callback
        self.active_callback = active_callback
        from nmlib.nm_remote_settings import ThreadVPNSpec
        self.td = ThreadVPNSpec(connection, self.on_active_conn_create)
        self.td.start()

    def on_active_conn_create(self, active_conn):
        #pass
        net_manager.emit_vpn_start(active_conn)

    def run(self):
        while self.td.isAlive():
            time.sleep(1)

        else:
            if self.td.succeed:
                #self.active_callback()
                pass
            else:
                #Dispatcher.emit('vpn-force-stop')
                #self.stop_callback()
                pass
        '''
示例#3
0
 def __init__(self, connection, stop_callback, active_callback):
     threading.Thread.__init__(self)
     self.setDaemon(True)
     self.connection = connection
     self.stop_callback = stop_callback
     self.active_callback = active_callback
     from nmlib.nm_remote_settings import ThreadVPNSpec
     self.td = ThreadVPNSpec(connection, self.on_active_conn_create)
     self.td.start()
 def __init__(self, connection, stop_callback, active_callback):
     threading.Thread.__init__(self)
     self.setDaemon(True)
     self.connection = connection
     self.stop_callback = stop_callback
     self.active_callback = active_callback
     from nmlib.nm_remote_settings import ThreadVPNSpec
     self.td = ThreadVPNSpec(connection, self.on_active_conn_create)
     self.td.start()