def on_suspend(self, *args, **kwargs): from lib import udp from main import settings udp_port = settings.getUDPPort() if udp.proto(udp_port): udp.close(udp_port) return True
def stop(self): from lib import udp from main import settings from main.config import conf udp_port = settings.getUDPPort() if udp.proto(udp_port): udp.close(udp_port) conf().removeCallback('services/udp-datagrams/udp-port') return True
def stop(self): from lib import udp from main import settings from main.config import conf udp_port = settings.getUDPPort() if udp.proto(udp_port): udp.close(udp_port) conf().removeConfigNotifier('services/udp-datagrams/udp-port') return True
def doSetDown(self, arg): """ """ if _Debug: lg.out(_DebugLevel, 'network_connector.doSetDown') # Second Approach # l = [] # for service_name in driver.affecting('service_network'): # d = driver.stop_single(service_name) # l.append(d) # # def _ok(x): # lg.info('network child services is DOWN') # self.automat('network-down') # return None # # def _fail(err): # lg.err(err) # self.automat('network-down') # return None # # dl = DeferredList(l, fireOnOneErrback=True, consumeErrors=True) # dl.addCallback(_ok) # d.addErrback(_fail) # First Solution if driver.is_on('service_gateway'): from transport import gateway gateway.stop() if driver.is_on('service_ip_port_responder'): from stun import stun_server stun_server.A('stop') if driver.is_on('service_service_entangled_dht'): from dht import dht_service dht_service.disconnect() if driver.is_on('service_udp_datagrams'): from lib import udp udp_port = settings.getUDPPort() if udp.proto(udp_port): udp.close(udp_port) self.automat('network-down')
def doSetDown(self, *args, **kwargs): """ """ if _Debug: lg.out(_DebugLevel, 'network_connector.doSetDown') if driver.is_on('service_gateway'): from transport import gateway gateway.stop() if driver.is_on('service_ip_port_responder'): from stun import stun_server stun_server.A('stop') if driver.is_on('service_service_entangled_dht'): from dht import dht_service dht_service.disconnect() if driver.is_on('service_udp_datagrams'): from lib import udp udp_port = settings.getUDPPort() if udp.proto(udp_port): udp.close(udp_port) self.automat('network-down')