Ejemplo n.º 1
0
 def stop(self):
     from transport import packet_out
     from transport import packet_in
     from transport import gateway
     gateway.stop()
     gateway.shutdown()
     packet_out.shutdown()
     packet_in.shutdown()
     return True
Ejemplo n.º 2
0
 def doSetDown(self, arg):
     """
     """
     if _Debug:
         lg.out(_DebugLevel, 'network_connector.doSetDown')
     if driver.is_on('service_service_entangled_dht'):
         from dht import dht_service
         dht_service.disconnect()
     if driver.is_on('service_ip_port_responder'):
         from stun import stun_server
         stun_server.A('stop')
     if driver.is_on('service_gateway'):
         from transport import gateway
         gateway.stop()
     self.automat('network-down')
Ejemplo n.º 3
0
 def stop(self):
     from transport import gateway
     from transport import callback
     from transport import bandwidth
     callback.remove_inbox_callback(bandwidth.INfile)
     callback.remove_finish_file_sending_callback(bandwidth.OUTfile)
     d = gateway.stop()
     bandwidth.shutdown()
     gateway.shutdown()
     return d
Ejemplo n.º 4
0
    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')
Ejemplo n.º 5
0
 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')
Ejemplo n.º 6
0
    def stop(self):
        from transport import gateway
        from transport import callback
        from transport import bandwidth

        callback.remove_inbox_callback(bandwidth.INfile)
        callback.remove_finish_file_sending_callback(bandwidth.OUTfile)
        d = gateway.stop()
        bandwidth.shutdown()
        gateway.shutdown()
        return d
Ejemplo n.º 7
0
 def doSetDown(self, arg):
     """
     
     """
     if _Debug:
         lg.out(_DebugLevel, 'network_connector.doSetDown')
     if driver.is_on('service_service_entangled_dht'):
         from dht import dht_service
         dht_service.disconnect()
     if driver.is_on('service_ip_port_responder'):
         from stun import stun_server
         stun_server.A('stop')
     # if driver.is_on('service_identity_server'):
     #     if settings.enableIdServer():
     #         from userid import id_server
     #         id_server.A('stop')
     if driver.is_on('service_gateway'):
         from transport import gateway
         gateway.stop()
     # if driver.is_on('service_my_ip_port'):
     #     from stun import stun_client
     #     stun_client.A().drop...
     self.automat('network-down')
Ejemplo n.º 8
0
 def on_suspend(self, *args, **kwargs):
     from transport import gateway
     return gateway.stop()