fix asyncio loop
This commit is contained in:
parent
fe7d1ccd7f
commit
4615b9134d
@ -1109,6 +1109,7 @@ class Network(util.DaemonThread):
|
|||||||
privkey = b"\x21"*32 + b"\x01"
|
privkey = b"\x21"*32 + b"\x01"
|
||||||
peer = Peer(privkey, host, port, pubkey)
|
peer = Peer(privkey, host, port, pubkey)
|
||||||
self.futures.append(asyncio.run_coroutine_threadsafe(peer.main_loop(loop), loop))
|
self.futures.append(asyncio.run_coroutine_threadsafe(peer.main_loop(loop), loop))
|
||||||
|
loop.run_forever()
|
||||||
|
|
||||||
threading.Thread(target=asyncioThread).start()
|
threading.Thread(target=asyncioThread).start()
|
||||||
networkAndWalletLock.acquire()
|
networkAndWalletLock.acquire()
|
||||||
@ -1121,7 +1122,7 @@ class Network(util.DaemonThread):
|
|||||||
networkAndWalletLock.release()
|
networkAndWalletLock.release()
|
||||||
networkAndWalletLock.acquire()
|
networkAndWalletLock.acquire()
|
||||||
# cancel tasks
|
# cancel tasks
|
||||||
[f.cancel for f in self.futures]
|
[f.cancel() for f in self.futures]
|
||||||
loop.stop()
|
loop.stop()
|
||||||
if loop.is_running(): time.sleep(0.1)
|
if loop.is_running(): time.sleep(0.1)
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user