-
Notifications
You must be signed in to change notification settings - Fork 25
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
refactor: Improve rendezvous protocol usage #399
Conversation
15bb0a0
to
7fade98
Compare
Codecov Report
@@ Coverage Diff @@
## main #399 +/- ##
==========================================
- Coverage 71.91% 70.82% -1.10%
==========================================
Files 71 72 +1
Lines 6955 7190 +235
==========================================
+ Hits 5002 5092 +90
- Misses 1953 2098 +145
|
We only want to add addresses for ourself to external addresses.
Only dial when we are not at connected peer limit. Only dial peers we are not already connected to.
Add cache with eviction listener to trigger discovery and renewal events on an interval and at TTL respectively.
0c6a567
to
15f4d32
Compare
Extracts timestamps for logs with matching predicates.
29d0527
to
5b37c6c
Compare
2de7817
to
4d7ad72
Compare
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.
First pass. Need to look at the tests a little more, but this is looking great.
request_response_senders: FnvHashMap<RequestId, (RequestResponseKey, P2PSender)>, | ||
rendezvous_registration_ttl: Duration, |
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.
@bgins thinking maybe we do have some substruct here: rendezvous, which has ttl and discovery interval and cookies? Trying to clean up this bit on length here. We may want the same for the two connected peers.
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.
Done! Also added discovered_peers
to the rendezvous one because it is not relevant for peers discovered through mDNS. We may revisit if we use the proposed ambient discovery protocol in the future.
Was slightly unsure about the naming for the connected peers one. Went with this struct:
homestar/homestar-runtime/src/event_handler.rs
Lines 104 to 108 in 1d4079b
// Connected peers configuration and state | |
struct Connections { | |
peers: FnvHashMap<PeerId, ConnectedPoint>, | |
max_peers: u32, | |
} |
Which on the event handler is:
connections: Connections, |
And when used we have event_handler.connections.peers
and event_handler.connections.max_peers
. In the first one, having connections
and peers
seems a bit redundant? I might be overthinking it.
1d4079b
to
c4bbd5f
Compare
2d6ab6f
to
263a871
Compare
Description
This pull request implements the following features:
external_addresses
Dialing
,PeerRegistered
, andRegistrationExpired
event debug logsenable_rendezvous
config intoenable_rendezvous_server
andenable_rendezvous_client
configs (server is opt-in, client is opt-out)max_connected_peers
configrendezvous_registration_ttl
andrendezvous_discovery_interval
configsextract_timestamps_where
andcount_lines_where
test utilitiesLink to issue
Implements #131.
Type of change
Test plan (required)
We are adding tests to check existing functionality and a test to check registration renewals.