-
-
Notifications
You must be signed in to change notification settings - Fork 107
fix: allow parallel connection attempts (max 3 concurrent) #2174
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
Merged
sanity
merged 86 commits into
fix/seeding-subscriber-nat-2164
from
fix/parallel-connect-priority1-2173
Dec 2, 2025
+121
−86
Merged
Changes from 84 commits
Commits
Show all changes
86 commits
Select commit
Hold shift + click to select a range
23e7c94
ci: trigger workflow
sanity 6db7a1c
ci: trigger workflow
sanity 665c15d
ci: trigger workflow
sanity 9e0c1c6
ci: trigger workflow
sanity 0cb7aa4
ci: trigger workflow
sanity 184f5dc
ci: trigger workflow
sanity b160fe7
ci: trigger workflow
sanity 3210f83
ci: trigger workflow
sanity 0d145f7
ci: trigger workflow
sanity 953a94e
ci: trigger workflow
sanity 492f3bd
ci: trigger workflow
sanity 105bc12
ci: trigger workflow
sanity 844f997
ci: trigger workflow
sanity ea6bd39
ci: trigger workflow
sanity 4a8c31d
ci: trigger workflow
sanity 9a2bf62
ci: trigger workflow
sanity a8660f3
ci: trigger workflow
sanity 46bcb8d
ci: retrigger CI
sanity 01cd810
ci: retrigger CI
sanity 8704c31
ci: trigger workflow
sanity dd9d9e8
ci: trigger workflow
sanity 05290cd
ci: trigger workflow
sanity 46dbd73
ci: trigger workflow
sanity 128a012
ci: trigger workflow
sanity 08dfa32
ci: trigger workflow
sanity c09018c
ci: trigger workflow
sanity 4055765
ci: trigger workflow
sanity 37d81ac
ci: trigger workflow
sanity 9a1fc72
ci: trigger workflow
sanity 39aa8c6
ci: trigger workflow
sanity fdf245e
ci: trigger workflow
sanity 4d44419
ci: retrigger CI
sanity 442f79b
ci: retrigger CI
sanity 3d50a69
ci: trigger workflow
sanity 6e8edbd
ci: trigger workflow
sanity 11df228
ci: trigger workflow
sanity f12734d
ci: trigger workflow
sanity 6ca5c58
ci: trigger workflow
sanity 1ec15bc
refactor(ring): restructure PeerKeyLocation to separate identity from…
sanity 3bcb68e
ci: trigger workflow
sanity 1969da5
refactor: wire protocol cleanup - remove sender fields from messages
sanity 97c0e06
ci: trigger workflow
sanity 8a35f1f
ci: trigger workflow
sanity ea42bed
ci: retrigger CI
sanity a67f088
ci: retrigger CI
sanity 31a5f0a
ci: trigger workflow
sanity 845a348
ci: trigger workflow
sanity 90861db
ci: trigger workflow
sanity 6d7add6
ci: trigger workflow
sanity bbe456c
ci: trigger workflow
sanity 5d1e6c3
ci: trigger workflow
sanity 319bd7c
ci: trigger workflow
sanity 0f82d71
ci: trigger workflow
sanity 9e0bc5e
ci: retrigger CI
sanity 3238051
ci: retrigger CI
sanity 8f104b7
ci: trigger workflow
sanity 77d5eb7
ci: trigger workflow
sanity 87ab2ab
ci: trigger workflow
sanity 40b0c07
ci: trigger workflow
sanity 9172101
refactor: wire protocol cleanup - remove sender fields from messages
sanity 6d46ac6
refactor: migrate PeerKeyLocation field accesses to use new methods
sanity 3cfc103
ci: trigger workflow
sanity 1deecca
refactor: wire protocol cleanup - remove sender fields from messages
sanity 46771ec
ci: retrigger CI
sanity e7b5a54
ci: retrigger CI
sanity 24cabd9
refactor(ring): restructure PeerKeyLocation to separate identity from…
sanity 223f45d
ci: trigger workflow
sanity 773a11a
refactor: wire protocol cleanup - remove sender fields from messages
sanity bba9a02
ci: trigger workflow
sanity a67aaab
refactor: migrate PeerKeyLocation field accesses to use new methods
sanity e7a8b5e
ci: trigger workflow
sanity a730092
refactor: wire protocol cleanup - remove sender fields from messages
sanity bd3775a
ci: retrigger CI
sanity d88332e
ci: retrigger CI
sanity e282c13
refactor: migrate PeerKeyLocation field accesses to use new methods
sanity 2f1c538
refactor(ring): restructure PeerKeyLocation to separate identity from…
sanity 3c3e3d7
refactor: use ObservedAddr newtype for source_addr throughout
sanity 7bbc163
ci: trigger workflow
sanity d5bf4ff
refactor: wire protocol cleanup - remove sender fields from messages
sanity 942a45d
fix: allow parallel connection attempts (max 3 concurrent)
sanity 2dccc75
test: add unit tests for active_transaction_count
sanity 41d73f2
ci: retrigger CI
sanity ab1ee8d
fix: resolve API mismatches after rebase
sanity bf5356f
fix: use pub_key() instead of peer() in connect tracing
sanity f9a1f7a
fix: incorporate PR #2172 fixes into PR #2174
sanity c57e118
fix: fill subscriber address before calling .peer() to avoid panic
sanity File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,11 +47,71 @@ impl LiveTransactionTracker { | |
| self.tx_per_peer.contains_key(&peer_addr) | ||
| } | ||
|
|
||
| pub(crate) fn still_alive(&self, tx: &Transaction) -> bool { | ||
| self.tx_per_peer.iter().any(|e| e.value().contains(tx)) | ||
| } | ||
|
|
||
| pub(crate) fn len(&self) -> usize { | ||
| self.tx_per_peer.len() | ||
| } | ||
|
|
||
| /// Returns the total number of active transactions across all peers. | ||
| pub(crate) fn active_transaction_count(&self) -> usize { | ||
| self.tx_per_peer | ||
| .iter() | ||
| .map(|entry| entry.value().len()) | ||
| .sum() | ||
| } | ||
|
Comment on lines
+54
to
+60
|
||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
| use crate::operations::connect::ConnectMsg; | ||
|
|
||
| #[test] | ||
| fn active_transaction_count_empty() { | ||
| let tracker = LiveTransactionTracker::new(); | ||
| assert_eq!(tracker.active_transaction_count(), 0); | ||
| } | ||
|
|
||
| #[test] | ||
| fn active_transaction_count_single_peer() { | ||
| let tracker = LiveTransactionTracker::new(); | ||
| let addr: SocketAddr = "127.0.0.1:8080".parse().unwrap(); | ||
|
|
||
| tracker.add_transaction(addr, Transaction::new::<ConnectMsg>()); | ||
| assert_eq!(tracker.active_transaction_count(), 1); | ||
|
|
||
| tracker.add_transaction(addr, Transaction::new::<ConnectMsg>()); | ||
| assert_eq!(tracker.active_transaction_count(), 2); | ||
| } | ||
|
|
||
| #[test] | ||
| fn active_transaction_count_multiple_peers() { | ||
| let tracker = LiveTransactionTracker::new(); | ||
| let addr1: SocketAddr = "127.0.0.1:8080".parse().unwrap(); | ||
| let addr2: SocketAddr = "127.0.0.1:8081".parse().unwrap(); | ||
|
|
||
| tracker.add_transaction(addr1, Transaction::new::<ConnectMsg>()); | ||
| tracker.add_transaction(addr1, Transaction::new::<ConnectMsg>()); | ||
| tracker.add_transaction(addr2, Transaction::new::<ConnectMsg>()); | ||
|
|
||
| assert_eq!(tracker.active_transaction_count(), 3); | ||
| } | ||
|
|
||
| #[test] | ||
| fn active_transaction_count_after_removal() { | ||
| let tracker = LiveTransactionTracker::new(); | ||
| let addr: SocketAddr = "127.0.0.1:8080".parse().unwrap(); | ||
|
|
||
| let tx1 = Transaction::new::<ConnectMsg>(); | ||
| let tx2 = Transaction::new::<ConnectMsg>(); | ||
|
|
||
| tracker.add_transaction(addr, tx1); | ||
| tracker.add_transaction(addr, tx2); | ||
| assert_eq!(tracker.active_transaction_count(), 2); | ||
|
|
||
| tracker.remove_finished_transaction(tx1); | ||
| assert_eq!(tracker.active_transaction_count(), 1); | ||
|
|
||
| tracker.remove_finished_transaction(tx2); | ||
| assert_eq!(tracker.active_transaction_count(), 0); | ||
| } | ||
| } | ||
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This behavioral change from the previous implementation removes protection against known-but-incorrect NAT addresses. The old code (visible in removed lines elsewhere in this diff) would always use the transport source address when available, specifically to handle cases where NAT peers embed known-but-wrong addresses (e.g.,
127.0.0.1:31337or internal network addresses like192.168.x.x).The new conditional logic only fills in addresses marked as
PeerAddr::Unknown, meaning if a NAT peer mistakenly sendsPeerAddr::Known(127.0.0.1:31337)instead ofPeerAddr::Unknown, the loopback address will not be corrected.While this change aligns subscribe.rs with the pattern used in connect.rs and put.rs, it removes a safety mechanism that was explicitly documented as "critical for NAT peers" in the old code comments. This could break existing clients behind NAT that haven't been updated to send
PeerAddr::Unknownwhen they don't know their external address.Consider either: