From: Roger A. Light Date: Sat, 1 Nov 2014 11:20:10 +0000 (+0000) Subject: [448428] Fix possible race condition connecting with loop_start(). X-Git-Tag: v1.1~1 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=a3e8e69466d7da5b147bd07d14adc38013781509;p=packages%2Fp%2Fpaho-mqtt.git [448428] Fix possible race condition connecting with loop_start(). If the connection in loop_start() does not complete before loop_stop() is called the network thread never ends. Thanks to Kees Bakker. Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=448428 Change-Id: If44b313cd0e642b4bf98182d8e50c4da6a8d975c --- diff --git a/ChangeLog.txt b/ChangeLog.txt index 6e1886a..8db2050 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,10 @@ +v1.0.3 - 2014-11-XX +=================== + +- Fix possible race condition if the connection in loop_start() does not + complete before loop_stop() is called, meaning the network thread never + ends. Closes #448428. Thanks to Kees Bakker. + v1.0.2 - 2014-09-13 =================== diff --git a/src/paho/mqtt/client.py b/src/paho/mqtt/client.py index b662aeb..46d0833 100755 --- a/src/paho/mqtt/client.py +++ b/src/paho/mqtt/client.py @@ -1282,6 +1282,7 @@ class Client(object): if self._thread is not None: return MQTT_ERR_INVAL + self._thread_terminate = False self._thread = threading.Thread(target=self._thread_main) self._thread.daemon = True self._thread.start() @@ -2247,8 +2248,6 @@ class Client(object): self._callback_mutex.release() def _thread_main(self): - run = True - self._thread_terminate = False self._state_mutex.acquire() if self._state == mqtt_cs_connect_async: self._state_mutex.release()