fix(protocol): consume default outbound slot on dial success, not failure#5102
Open
damip wants to merge 1 commit into
Open
fix(protocol): consume default outbound slot on dial success, not failure#5102damip wants to merge 1 commit into
damip wants to merge 1 commit into
Conversation
…lure The default-category branch in start_connectivity_thread consumed a slot and recorded the address as connected on try_connect_peer(...).is_err() instead of .is_ok(), inverted relative to the special-category branch. This could leave the node under-connected after failed dials or exceed the outbound target after successful dials. Consume the slot on success. Finding F140. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
In
start_connectivity_thread's outbound dialing loop, the default-categorybranch consumed a connection slot and recorded the address as connected on
try_connect_peer(...).is_err()— i.e. on failure — which is inverted.Compare the special-category branch just above, which (correctly) consumes the slot
and records the address on
.is_ok().Because of the inversion, for uncategorized peers:
node could stop dialing while still under-connected;
outbound target for the default category.
Change
Consume the default-category slot and record the address on success (
.is_ok()),mirroring the special-category branch.
Testing
cargo build/cargo clippyclean formassa_protocol_worker.select!loop; exercising it in isolation would require a full network-controllermock and connectivity-thread harness, so no dedicated unit test is added. The change
is verified by direct comparison with the adjacent, correct special-category branch.
Risk
Low — it aligns the default-category accounting with the already-correct
special-category accounting.
Tracking: finding F140.