Repository navigation
Read the device's record before send_anon_req changes its path - #131
Merged
Merged
Conversation
When meshcore's copy of a contact said flood, send_anon_req set a zero-hop path on the device, sent, then reset the path to flood. If the device held a path the copy didn't know about (set by another app, or since the contacts were last read), it was left with none. It now reads the device's record by key first: - a path the device holds is used for the request and left alone (and copied into meshcore's contact); - a flood record is set to zero-hop, written from the device's own record so nothing else in it changes, and reset to flood after sending, as before; - a contact the device doesn't hold is sent to as an unknown destination, rather than added to the device; - if the record can't be read, nothing is changed or sent. Part of meshcore-dev#119 (B4).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong (#119, B4)
out_path_len == -1),send_anon_reqset a zero-hop path on the radio, sent the request, then calledreset_path.What changed: when the copy says flood,
send_anon_reqfirst reads the radio's record by key (get_contact_by_key), then:ERRORwithreason: contact_read_failed.I chose to read rather than skip the change outright, because a flood record still needs the zero-hop for the server to answer (it gates these behind
isRouteDirect()). This costs one extra round trip, only when the copy says flood. Two existing tests intest_error_handling.pynow mock the read.Verified
tests/unit/test_anon_req_device_path.py. They fail on currentmain.… 00). On currentmain:On this branch:
With the radio holding flood, this branch sends
1e,16 03,09(zero-hop),39,0d, as currentmaindoes. The reply arrives, and the record readsffagain afterwards.Part of #119.