kopia lustrzana https://github.com/Yakifo/amqtt
commit
3f8c994f58
|
@ -164,7 +164,7 @@ class MQTTClient:
|
|||
|
||||
This method is a *coroutine*.
|
||||
"""
|
||||
|
||||
yield from self.cancel_tasks()
|
||||
if self.session.transitions.is_connected():
|
||||
if not self._disconnect_task.done():
|
||||
self._disconnect_task.cancel()
|
||||
|
@ -175,6 +175,19 @@ class MQTTClient:
|
|||
else:
|
||||
self.logger.warning("Client session is not currently connected, ignoring call")
|
||||
|
||||
@asyncio.coroutine
|
||||
def cancel_tasks(self):
|
||||
"""
|
||||
Before disconnection need to cancel all pending tasks
|
||||
:return:
|
||||
"""
|
||||
try:
|
||||
while True:
|
||||
task = self.client_tasks.pop()
|
||||
task.cancel()
|
||||
except IndexError as err:
|
||||
pass
|
||||
|
||||
@asyncio.coroutine
|
||||
def reconnect(self, cleansession=None):
|
||||
"""
|
||||
|
|
Ładowanie…
Reference in New Issue