Skip to content

Commit a7b1f3d

Browse files
authored
Merge pull request adafruit#87 from DynamicDevices/ajl/fix-multiple-pingreqs
adafruit_minimqtt: Fix issue adafruit#86 with multiple poll() PINGREQs
2 parents 99cd90f + 06edc03 commit a7b1f3d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

adafruit_minimqtt/adafruit_minimqtt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,13 +776,13 @@ def loop(self, timeout=1):
776776
self._timestamp = time.monotonic()
777777
current_time = time.monotonic()
778778
if current_time - self._timestamp >= self.keep_alive:
779+
self._timestamp = 0
779780
# Handle KeepAlive by expecting a PINGREQ/PINGRESP from the server
780781
if self.logger is not None:
781782
self.logger.debug(
782783
"KeepAlive period elapsed - requesting a PINGRESP from the server..."
783784
)
784785
rcs = self.ping()
785-
self._timestamp = 0
786786
return rcs
787787
self._sock.settimeout(timeout)
788788
rc = self._wait_for_msg()

0 commit comments

Comments
 (0)