Add connection_lost. Properly handle shutdown of watch_q.

This commit is contained in:
Richard Kiss 2017-05-14 14:04:46 -07:00
parent 4b4c312fbe
commit f38a796181
2 changed files with 4 additions and 1 deletions

View File

@ -61,7 +61,7 @@ def main():
database.close()
watch_q_task.cancel()
loop.run_until_complete(node.shutdown())
loop.run_until_complete(watch_q_task)
loop.run_until_complete(asyncio.wait([watch_q_task]))
return 0

View File

@ -62,6 +62,9 @@ class SybilNode:
self._tasks.append(self._loop.create_task(self.increase_neighbour_task()))
self._transport = transport
def connection_lost(self, exc):
self._is_paused = True
def pause_writing(self):
self._is_paused = True