Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect max_inlight message count in reconnect #698

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/paho/mqtt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2945,16 +2945,18 @@ def _check_clean_session(self):
def _messages_reconnect_reset_out(self):
with self._out_message_mutex:
self._inflight_messages = 0
to_be_inflight = 0
for m in self._out_messages.values():
m.timestamp = 0
if self._max_inflight_messages == 0 or self._inflight_messages < self._max_inflight_messages:
if self._max_inflight_messages == 0 or to_be_inflight < self._max_inflight_messages:
if m.qos == 0:
m.state = mqtt_ms_publish
elif m.qos == 1:
# self._inflight_messages = self._inflight_messages + 1
if m.state == mqtt_ms_wait_for_puback:
m.dup = True
m.state = mqtt_ms_publish
to_be_inflight += 1
elif m.qos == 2:
# self._inflight_messages = self._inflight_messages + 1
if self._check_clean_session():
Expand All @@ -2968,6 +2970,7 @@ def _messages_reconnect_reset_out(self):
if m.state == mqtt_ms_wait_for_pubrec:
m.dup = True
m.state = mqtt_ms_publish
to_be_inflight += 1
else:
m.state = mqtt_ms_queued

Expand Down