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')
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')
def start(self): from transport import callback from chat import message from chat import message_keeper from chat import message_db from chat import nickname_holder message.init() message_db.init() nickname_holder.A('set') callback.append_inbox_callback(self._on_inbox_packet_received) message_keeper.init() return True
def start(self): from main import events from transport import callback from stream import message from chat import nickname_holder message.init() nickname_holder.A('set') callback.append_inbox_callback(self._on_inbox_packet_received) events.add_subscriber(self._on_identity_url_changed, 'identity-url-changed') events.add_subscriber(self._on_user_connected, 'node-connected') events.add_subscriber(self._on_user_disconnected, 'node-disconnected') return True
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 chat import nickname_holder nickname_holder.A('set') return True