From: Roger A. Light Date: Sat, 13 Sep 2014 20:19:09 +0000 (+0100) Subject: [443881] Handle exceptions from select() in client loop() function. X-Git-Tag: v1.1~6 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=80b4bcadda39377ae250060deb4ef426d5fa43a4;p=packages%2Fp%2Fpaho-mqtt.git [443881] Handle exceptions from select() in client loop() function. Handle exceptions from select() in client loop() function. Closes #443881. Thanks to Jeff Jasper. Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=443881 Change-Id: I4bbee80554917b61a0d413dc490370391a6fe2b5 --- diff --git a/ChangeLog.txt b/ChangeLog.txt index 75d04c0..9feab32 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -11,6 +11,8 @@ v1.0.2 - Fix possible race condition when connecting with TLS and publishing at the same time, which could lead to PUBLISH data being sent before any other messages and unencrypted. Closes #443964. Thanks to Hiram van Paassen. +- Handle exceptions from select() in client loop() function. Closes #443881. + Thanks to Jeff Jasper. v1.0.1 diff --git a/src/paho/mqtt/client.py b/src/paho/mqtt/client.py index 264f782..a817f78 100755 --- a/src/paho/mqtt/client.py +++ b/src/paho/mqtt/client.py @@ -802,6 +802,12 @@ class Client(object): except TypeError: # Socket isn't correct type, in likelihood connection is lost return MQTT_ERR_CONN_LOST + except ValueError: + # Can occur if we just reconnected but rlist/wlist contain a -1 for + # some reason. + return MQTT_ERR_CONN_LOST + except: + return MQTT_ERR_UNKNOWN if self.socket() in socklist[0]: rc = self.loop_read(max_packets)