def __init__(self, my_node, conf_path, routing_m_mod, lookup_m_mod, experimental_m_mod, private_dht_name, debug_level, bootsrap_mode=False, swift_port=0): logging_conf.setup(conf_path, debug_level) state_filename = os.path.join(conf_path, controller.STATE_FILENAME) self.controller = controller.Controller( VERSION_LABEL, my_node, state_filename, routing_m_mod, lookup_m_mod, experimental_m_mod, private_dht_name, bootsrap_mode) self.reactor = minitwisted.ThreadedReactor( self.controller.main_loop, my_node.addr[1], self.controller.on_datagram_received) self.reactor.start() self.swift_tracker_thread = None if swift_port: print 'Creating SwiftTracker' self.swift_tracker_thread = swift_tracker.SwiftTracker( self, swift_port) self.swift_tracker_thread.start() self.timestamps = [] self.max_num_sec = 0 self.max_num_min = 0 self.max_num_10min = 0
def __init__(self, my_node, conf_path, routing_m_mod, lookup_m_mod, experimental_m_mod, private_dht_name, debug_level, auto_bootstrap=True, bootstrap_mode=False, swift_port=0): logging_conf.setup(conf_path, debug_level) self.controller = controller.Controller( VERSION_LABEL, my_node, conf_path, routing_m_mod, lookup_m_mod, experimental_m_mod, private_dht_name, bootstrap_mode) self.reactor = minitwisted.ThreadedReactor( self.controller.main_loop, my_node.addr[1], self.controller.on_datagram_received) if swift_port: print 'Creating SwiftTracker' swift_tracker.SwiftTracker(self, swift_port).start() self.timestamps = [] self.max_num_sec = 0 self.max_num_min = 0 self.max_num_10min = 0 if auto_bootstrap: # Overlay bootstrap self.get_peers(None, self.controller._my_id, None, 0) self.reactor.start()
def setup(self): if RUN_NETWORK_TESTS: time.sleep(1) # Reduce test interdependence self.got_response = False self.got_timeout = False self.got_error = False self.found_nodes = False self.got_routing_response = False self.got_routing_error = False self.got_routing_timeout = False self.got_routing_nodes_found = False self.querier_mock = querier.QuerierMock(tc.CLIENT_ID) self.r = minitwisted.ThreadedReactor(task_interval=.01) self.rpc_m = rpc_manager.RPCManager(self.r, tc.CLIENT_ADDR[1]) self.querier = querier.Querier(self.rpc_m, tc.CLIENT_NODE) self.querier_routing = querier.Querier(self.rpc_m, tc.CLIENT_NODE) self.querier_routing.set_on_response_received_callback( self.on_routing_response) self.querier_routing.set_on_error_received_callback( self.on_routing_error) self.querier_routing.set_on_timeout_callback( self.on_routing_timeout) self.querier_routing.set_on_nodes_found_callback( self.on_routing_nodes_found) self.r.start()
def setup(self): self.reactor = minitwisted.ThreadedReactor() self.c = rpc_manager.RPCManager(self.reactor, tc.CLIENT_ADDR[1]) self.s = rpc_manager.RPCManager(self.reactor, tc.SERVER_ADDR[1]) self.got_query = False self.got_response = False self.got_routing_response = False self.got_error = False self.got_timeout = False self.got_routing_timeout = False
def setup(self): import rpc_manager global time time = minitwisted.time = querier.time = MockTime() self.got_response = False self.got_timeout = False self.got_error = False self.querier = querier.Querier(tc.CLIENT_ID) self.r = minitwisted.ThreadedReactor(task_interval=.01) self.rpc_m = rpc_manager.RPCManager(self.r) self.querier = querier.Querier(tc.CLIENT_NODE) self.r.start()
def __init__(self, my_node, conf_path, routing_m_mod, lookup_m_mod, experimental_m_mod, private_dht_name, debug_level, id_=None, bootsrap_mode=False): logging_conf.setup(conf_path, debug_level) state_filename = os.path.join(conf_path, controller.STATE_FILENAME) self.controller = controller.Controller( VERSION_LABEL, my_node, state_filename, routing_m_mod, lookup_m_mod, experimental_m_mod, private_dht_name, bootsrap_mode) self.reactor = minitwisted.ThreadedReactor( self.controller.main_loop, my_node.addr[1], self.controller.on_datagram_received) self.reactor.start()