]> git.michaelhowe.org Git - packages/p/paho-mqtt.git/commitdiff
[448428] Fix possible race condition connecting with loop_start().
authorRoger A. Light <roger@atchoo.org>
Sat, 1 Nov 2014 11:20:10 +0000 (11:20 +0000)
committerRoger A. Light <roger@atchoo.org>
Sat, 1 Nov 2014 11:20:10 +0000 (11:20 +0000)
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

ChangeLog.txt
src/paho/mqtt/client.py

index 6e1886ae41a6881c309a09b50467d44af69bf9a9..8db2050c8604886b5f23421287a278456d557b00 100644 (file)
@@ -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
 ===================
 
index b662aeb7ad41100ee24109dee86357e2a627a768..46d0833f46ba53ba32a4ce3718a998928839e1a4 100755 (executable)
@@ -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()