-
Notifications
You must be signed in to change notification settings - Fork 726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix is_connected property when not using loop_forever #795
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are stray logger initializations and log calls in here :)
A test would probably not go amiss either.
src/paho/mqtt/client.py
Outdated
logging.basicConfig(level=logging.DEBUG) | ||
self._logger = logging.getLogger("plop") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plop! 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, totally missed this temporary debugging code.
b9477ec
to
c2072bb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a couple more debug log calls remaining, as well as what I think may be a stray loop_stop()
(in a more perfect world, we'd use e.g. py.test fixtures or a with
block to manage loop_stop()
always getting called, but that's out of scope for this PR)
src/paho/mqtt/client.py
Outdated
@@ -1762,6 +1771,8 @@ def loop_misc(self) -> MQTTErrorCode: | |||
if self._state == mqtt_cs_disconnecting: | |||
rc = MQTTErrorCode.MQTT_ERR_SUCCESS | |||
else: | |||
self._state = ConnectionState.MQTT_CS_CONNECTION_LOST | |||
self._easy_log(MQTT_LOG_DEBUG, "... 2") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self._easy_log(MQTT_LOG_DEBUG, "... 2") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I should re-read my own PR more carefully :(
src/paho/mqtt/client.py
Outdated
@@ -2574,6 +2585,10 @@ def _loop_rc_handle( | |||
|
|||
self._do_on_disconnect(rc, properties) | |||
|
|||
if rc == MQTT_ERR_CONN_LOST: | |||
self._easy_log(MQTT_LOG_DEBUG, "... 3") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self._easy_log(MQTT_LOG_DEBUG, "... 3") |
tests/test_client.py
Outdated
finally: | ||
mqttc.loop_stop() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see loop_start
being called in this test..?
c52f872
to
a66ef8f
Compare
Fix #525