Skip to content

Commit 731607f

Browse files
committed
Re-ping if we are downloading
Don't disconnect. Send multiple pings during large downloads. Only disconn if _last_mg_in outside keep alive Don't close socket if _last_mg_in was within keep alive (don't rely on _ping_t only) Send out pingreq, do not disconnect, if downloading, or pingreq overdue. REvert loop misc but make it only disconnect on _last_msg_in, not _ping_t Run workflows on this branch This branch, not the other Disconnect if no ping response, but if downloading ping again, resetting _ping_t Run workflows on this branch Only re-ping if we are downloading
1 parent 7a3d161 commit 731607f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/paho/mqtt/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2174,6 +2174,8 @@ def loop_misc(self) -> MQTTErrorCode:
21742174

21752175
return MQTTErrorCode.MQTT_ERR_SUCCESS
21762176

2177+
2178+
21772179
def max_inflight_messages_set(self, inflight: int) -> None:
21782180
"""Set the maximum number of messages with QoS>0 that can be part way
21792181
through their network flow at once. Defaults to 20."""
@@ -3274,7 +3276,7 @@ def _check_keepalive(self) -> None:
32743276
last_msg_in = self._last_msg_in
32753277

32763278
if self._sock is not None and (now - last_msg_out >= self._keepalive or now - last_msg_in >= self._keepalive):
3277-
if self._state == _ConnectionState.MQTT_CS_CONNECTED and self._ping_t == 0:
3279+
if self._state == _ConnectionState.MQTT_CS_CONNECTED and (self._ping_t == 0 or now - last_msg_in < self.keepalive):
32783280
try:
32793281
self._send_pingreq()
32803282
except Exception:

0 commit comments

Comments
 (0)