network: stop loop on loop thread
This commit is contained in:
parent
24b619edee
commit
9e013d4ce0
@ -1086,8 +1086,11 @@ class Network(util.DaemonThread):
|
|||||||
networkAndWalletLock.acquire()
|
networkAndWalletLock.acquire()
|
||||||
# cancel tasks
|
# cancel tasks
|
||||||
[f.cancel() for f in self.futures]
|
[f.cancel() for f in self.futures]
|
||||||
self.asyncio_loop.stop()
|
async def loopstop():
|
||||||
if self.asyncio_loop.is_running(): time.sleep(0.1)
|
self.asyncio_loop.stop()
|
||||||
|
asyncio.run_coroutine_threadsafe(loopstop(), self.asyncio_loop)
|
||||||
|
while self.asyncio_loop.is_running():
|
||||||
|
time.sleep(0.1)
|
||||||
try:
|
try:
|
||||||
self.asyncio_loop.close()
|
self.asyncio_loop.close()
|
||||||
except:
|
except:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user