Exemplo n.º 1
0
 def doSetUp(self, *args, **kwargs):
     if _Debug:
         lg.out(_DebugLevel, 'network_connector.doSetUp')
     if driver.is_on('service_udp_datagrams'):
         from lib import udp
         udp_port = settings.getUDPPort()
         if not udp.proto(udp_port):
             try:
                 udp.listen(udp_port)
             except:
                 lg.exc()
     if driver.is_on('service_service_entangled_dht'):
         from dht import dht_service
         dht_service.reconnect()
     if driver.is_on('service_ip_port_responder'):
         from stun import stun_server
         udp_port = int(settings.getUDPPort())
         stun_server.A('start', udp_port)
     if driver.is_on('service_my_ip_port'):
         from stun import stun_client
         if not stun_client.A() or stun_client.A().state in ['STOPPED', ]: 
             stun_client.A().dropMyExternalAddress()
             stun_client.A('start')
     if driver.is_on('service_private_messages'):
         from chat import nickname_holder
         nickname_holder.A('set')
     self.automat('network-up')
Exemplo n.º 2
0
 def doSetUp(self, arg):
     if _Debug:
         lg.out(_DebugLevel, 'network_connector.doSetUp')
     # if driver.is_on('service_identity_server'):
     #     if settings.enableIdServer():
     #         from userid import id_server
     #         id_server.A('start', (settings.getIdServerWebPort(),
     #                               settings.getIdServerTCPPort()))
     if driver.is_on('service_service_entangled_dht'):
         from dht import dht_service
         dht_service.reconnect()
     if driver.is_on('service_ip_port_responder'):
         from stun import stun_server
         udp_port = int(settings.getUDPPort())
         stun_server.A('start', udp_port)
     if driver.is_on('service_my_ip_port'):
         from stun import stun_client
         stun_client.A().dropMyExternalAddress()
         stun_client.A('start')
     if driver.is_on('service_private_messages'):
         from chat import nickname_holder
         nickname_holder.A('set', None)
     # if driver.is_on('service_gateway'):
     #     from transport import gateway
     #     gateway.start()
     self.automat('network-up')
Exemplo n.º 3
0
    def doSetUp(self, arg):
        if _Debug:
            lg.out(_DebugLevel, 'network_connector.doSetUp')

#         Second attempt
#         l = []
#         for service_name in driver.affecting('service_network'):
#             d = driver.start_single(service_name)
#             l.append(d)
#
#         def _ok(x):
#             lg.info('network child services is UP')
#             self.automat('network-up')
#             return None
#
#         def _fail(err):
#             lg.err(err)
#             self.automat('network-up')
#             return None
#
#         dl = DeferredList(l, fireOnOneErrback=True, consumeErrors=True)
#         dl.addCallback(_ok)
#         d.addErrback(_fail)

# First Solution
        if driver.is_on('service_service_entangled_dht'):
            from dht import dht_service
            dht_service.reconnect()
        if driver.is_on('service_ip_port_responder'):
            from stun import stun_server
            udp_port = int(settings.getUDPPort())
            stun_server.A('start', udp_port)
        if driver.is_on('service_my_ip_port'):
            from stun import stun_client
            stun_client.A().dropMyExternalAddress()
            stun_client.A('start')
        if driver.is_on('service_private_messages'):
            from chat import nickname_holder
            nickname_holder.A('set')
        if driver.is_on('service_udp_datagrams'):
            from lib import udp
            udp_port = settings.getUDPPort()
            if not udp.proto(udp_port):
                try:
                    udp.listen(udp_port)
                except:
                    lg.exc()
        self.automat('network-up')
 def on_resume(self, *args, **kwargs):
     from dht import dht_service
     dht_service.reconnect()
     return True