def step_impl(context, i, j): i = int(i) j = int(j) iLayer = context.layers[i] jLayer = context.layers[j] assert((ip_address(j), port, jLayer.guid, nickname(j)) in iLayer.dht.knownNodes)
def create_nodes(context, num_nodes): app = [] for i in range(num_nodes): app.append(MarketApplication(ip_address(i), 12345, i, db_path=get_db_path(i), dev_mode=True)) app[i].listen(node_to_ws_port(i)) set_store_description(i) context.app = app
def create_layers(context, num_layers): layers = [] for i in range(num_layers): db_path = get_db_path(i) setup_db(db_path) # dev_mode is True because otherwise the layer's ip is set to the # public ip of the node layers.append(CryptoTransportLayer(ip_address(i), port, i, Obdb(db_path), dev_mode=True))
def create_layers(context, num_layers): layers = [] for i in range(num_layers): db_path = get_db_path(i) setup_db(db_path) # dev_mode is True because otherwise the layer's ip is set to the # public ip of the node layers.append(CryptoTransportLayer(ip_address(i), port, i, Obdb(db_path), dev_mode=True)) context.layers = layers
def create_nodes(context, num_nodes): app = [] for i in range(num_nodes): app.append( MarketApplication(ip_address(i), 12345, i, db_path=get_db_path(i), dev_mode=True)) app[i].listen(node_to_ws_port(i)) set_store_description(i) context.app = app
def step_impl(context, i, j): i = int(i) j = int(j) iLayer = context.layers[i] jLayer = context.layers[j] jLayer.join_network([]) def cb(msg): ioloop.IOLoop.current().stop() iLayer.join_network([ip_address(j)], callback=cb)
def step_impl(context, i, j): i = int(i) j = int(j) iLayer = context.layers[i] jLayer = context.layers[j] jLayer.join_network([]) def cb(msg): ioloop.IOLoop.current().stop() iLayer.join_network([ip_address(j)], callback=cb) ioloop.IOLoop.current().start()
def step_impl(context, i, j): i = int(i) j = int(j) iLayer = context.layers[i] jLayer = context.layers[j] assert((ip_address(j), port, jLayer.guid, nickname(j)) in iLayer._dht._knownNodes) # j is not necessarily in the database of i # db_peers = iLayer._db.selectEntries("peers") # assert(jLayer._uri in map(lambda x: x['uri'], known_peers)) # j is not necessarily in activePeers of i # assert(jLayer._guid in map(lambda x: x._guid, iLayer._dht._activePeers)) # j is not necessarily in peers of i # assert(jLayer._uri in iLayer._peers)