aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJamesC <james.chiangwu@gmail.com>2019-10-25 14:28:08 +0200
committerJames Chiang <james.chiangwu@gmail.com>2019-11-03 20:33:49 +0100
commitede8b7608e115364b5bb12e7f39d662145733de6 (patch)
tree250483e2a83385e11534b84225017be1aac3c412 /test
parent463eab5e1418a592036e7bf9bf46f66fe6462435 (diff)
Remove network_event_loop instance in close()
The asyncio.new_event_loop() instance is now removed from the NetworkThread class during shutdown. This enables a NetworkThread instance to be restarted after being closed. The current NetworkThread class guards against an existing new_event_loop during initialization.
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/test_framework/mininode.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/functional/test_framework/mininode.py b/test/functional/test_framework/mininode.py
index f95c158a68..a9e669fea9 100755
--- a/test/functional/test_framework/mininode.py
+++ b/test/functional/test_framework/mininode.py
@@ -478,7 +478,8 @@ class NetworkThread(threading.Thread):
wait_until(lambda: not self.network_event_loop.is_running(), timeout=timeout)
self.network_event_loop.close()
self.join(timeout)
-
+ # Safe to remove event loop.
+ NetworkThread.network_event_loop = None
class P2PDataStore(P2PInterface):
"""A P2P data store class.