peterhinch / micropython-mqtt

A 'resilient' asynchronous MQTT driver. Recovers from WiFi and broker outages.
MIT License
550 stars 117 forks source link

disconnect() doesn't work, triggers reconnect #31

Closed kevinkk525 closed 4 years ago

kevinkk525 commented 4 years ago

The disconnect method doesn't work because it just closes the socket but keep_connected is still running and triggers a reconnect. _has_connected would need to be reset and _keep_connected canceled. I might create a PR the next days if you like.

goatchurchprime commented 4 years ago

Does it use the cancellable feature from here? https://github.com/peterhinch/micropython-async/blob/master/PRIMITIVES.md#4-task-cancellation So many modules floating about you can't tell what's in and what's out.

kevinkk525 commented 4 years ago

It would use the uasyncio.cancel feature, which is described in the link you posted but could be implemented without a cancel feature too. Haven't looked into it too much yet.

kevinkk525 commented 4 years ago

fixed via #32