tDo some asyncio tasks cleanup in ElectrumProtocol.stop - obelisk - Electrum server using libbitcoin as its backend
HTML git clone https://git.parazyd.org/obelisk
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit acde0724e995c94416cd653f9fb73af0b59ac243
DIR parent 25e8f42479f13b252cb2923e44919dcac38f2950
HTML Author: parazyd <parazyd@dyne.org>
Date: Fri, 9 Apr 2021 01:26:34 +0200
Do some asyncio tasks cleanup in ElectrumProtocol.stop
Diffstat:
M electrumobelisk/protocol.py | 8 ++++++++
1 file changed, 8 insertions(+), 0 deletions(-)
---
DIR diff --git a/electrumobelisk/protocol.py b/electrumobelisk/protocol.py
t@@ -118,6 +118,14 @@ class ElectrumProtocol(asyncio.Protocol): # pylint: disable=R0904,R0902
self.log.debug("bx.unsubscribe %s", i)
await self.bx.unsubscribe_scripthash(i)
await self.bx.stop()
+
+ idxs = []
+ for task in self.tasks:
+ idxs.append(self.tasks.index(task))
+ task.cancel()
+ for i in idxs:
+ del self.tasks[i]
+
self.stopped = True
async def recv(self, reader, writer):