stop tasks before removing transport
This commit is contained in:
parent
99fc7178c1
commit
16a2023bbd
1 changed files with 2 additions and 2 deletions
|
@ -140,13 +140,13 @@ class TrackerClient:
|
||||||
lambda request: self.on_hash(request[1], request[2]) if request[0] == 'search' else None)
|
lambda request: self.on_hash(request[1], request[2]) if request[0] == 'search' else None)
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
|
while self.tasks:
|
||||||
|
self.tasks.popitem()[1].cancel()
|
||||||
if self.transport is not None:
|
if self.transport is not None:
|
||||||
self.transport.close()
|
self.transport.close()
|
||||||
self.client = None
|
self.client = None
|
||||||
self.transport = None
|
self.transport = None
|
||||||
self.EVENT_CONTROLLER.close()
|
self.EVENT_CONTROLLER.close()
|
||||||
while self.tasks:
|
|
||||||
self.tasks.popitem()[1].cancel()
|
|
||||||
|
|
||||||
def on_hash(self, info_hash, on_announcement=None):
|
def on_hash(self, info_hash, on_announcement=None):
|
||||||
if info_hash not in self.tasks:
|
if info_hash not in self.tasks:
|
||||||
|
|
Loading…
Reference in a new issue