Skip to content

Commit

Permalink
fix: Handle when transport has been garbage collected.
Browse files Browse the repository at this point in the history
  • Loading branch information
Siecje committed Sep 3, 2024
1 parent e75d1c2 commit 2e5ca85
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions azure-iot-device/azure/iot/device/common/mqtt_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ def on_connect(client, userdata, flags, rc):
logger.warning(
"connection failed, but no on_mqtt_connection_failure_handler handler callback provided"
)
elif not this:
logger.info(
"on_connect called with transport==None. Transport must have been garbage collected. stopping loop"
)
elif this.on_mqtt_connected_handler:
try:
this.on_mqtt_connected_handler()
Expand Down

0 comments on commit 2e5ca85

Please sign in to comment.