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

Improve ACK handling: pass to onAckNak and on request in sendData #602

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

ianmcorvidae
Copy link
Contributor

correctly pass them to onAckNak handlers, and add a mechanism for other handlers to request acks as well.

issue discovered looking at #594; not marking that fully closed though, because there's still an improvement to be made there in having implicit ACKs be ignored if a full ack desired/expected

… add a mechanism for other handlers to request acks as well.
Comment on lines +1142 to +1148
# we keep the responseHandler in dict until we actually call it
handler = self.responseHandlers.get(requestId, None)
if handler is not None:
if (not isAck) or handler.callback.__name__ == "onAckNak" or handler.ackPermitted:
handler = self.responseHandlers.pop(requestId, None)
logging.debug(f"Calling response handler for requestId {requestId}")
handler.callback(asDict)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(this is the change that fixes the bug -- previously we were not checking for onAckNak before shortcutting out of the handler in line 1135. This instead fetches the handler and checks if it should pass acks to it, but only removes it from the handlers if it decides it should)

Comment on lines +319 to +322
onResponseAckPermitted -- should the onResponse callback be called
for regular ACKs (True) or just data responses & NAKs (False)
Note that if the onResponse callback is called 'onAckNak' this
will implicitly be true.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now this is only added to sendData, but I will try to go through and add it to other helpers too, for library users' sake.

@ianmcorvidae
Copy link
Contributor Author

I'm not sure why codecov is complaining, but everything else seems fine, so I'll go ahead and merge anyway I think.

@ianmcorvidae ianmcorvidae merged commit b58094b into meshtastic:master Jun 21, 2024
5 of 9 checks passed
@ianmcorvidae ianmcorvidae deleted the improve-acks branch June 30, 2024 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant