obelisk

Electrum server using libbitcoin as its backend
git clone https://git.parazyd.org/obelisk
Log | Files | Refs | README | LICENSE

commit acde0724e995c94416cd653f9fb73af0b59ac243
parent 25e8f42479f13b252cb2923e44919dcac38f2950
Author: parazyd <parazyd@dyne.org>
Date:   Fri,  9 Apr 2021 01:26:34 +0200

Do some asyncio tasks cleanup in ElectrumProtocol.stop

Diffstat:
Melectrumobelisk/protocol.py | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/electrumobelisk/protocol.py b/electrumobelisk/protocol.py @@ -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):