Skip to content

Commit 4d2d15b

Browse files
committed
Only re-ping if we are downloading
1 parent 7ec24b0 commit 4d2d15b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/paho/mqtt/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3276,7 +3276,7 @@ def _check_keepalive(self) -> None:
32763276
last_msg_in = self._last_msg_in
32773277

32783278
if self._sock is not None and (now - last_msg_out >= self._keepalive or now - last_msg_in >= self._keepalive):
3279-
if self._state == _ConnectionState.MQTT_CS_CONNECTED:
3279+
if self._state == _ConnectionState.MQTT_CS_CONNECTED and (self._ping_t == 0 or now - last_msg_in < self.keepalive):
32803280
try:
32813281
self._send_pingreq()
32823282
except Exception:

0 commit comments

Comments
 (0)