various bugfixes after merge

This commit is contained in:
Bora M. Alper 2017-06-02 16:49:39 +03:00
parent 0c9adb95d4
commit fcecdba5b9
2 changed files with 4 additions and 6 deletions

View File

@ -53,14 +53,12 @@ def create_tasks():
logging.exception("could NOT connect to the database!")
return 1
complete_info_hashes = database.get_complete_info_hashes()
loop = asyncio.get_event_loop()
node = dht.SybilNode(arguments.node_addr, database.is_infohash_new, arguments.max_metadata_size)
loop.create_task(node.launch(loop))
watch_q_task = loop.create_task(watch_q(database, node.metadata_q()))
watch_q_task.add_done_callback(lambda x: clean_up(loop, database, node))
return watch_q_task
metadata_queue_watcher_task = loop.create_task(metadata_queue_watcher(database, node.metadata_q()))
metadata_queue_watcher_task.add_done_callback(lambda x: clean_up(loop, database, node))
return metadata_queue_watcher_task
def clean_up(loop, database, node):

View File

@ -54,7 +54,7 @@ class SybilNode:
logging.info("SybilNode %s on %s initialized!", self.__true_id.hex().upper(), address)
def metadata_q(self):
return self._metadata_q
return self.__metadata_queue
async def launch(self, loop):
self._loop = loop