Skip to content

Commit

Permalink
refactor: Improve rendezvous protocol usage (#399)
Browse files Browse the repository at this point in the history
# Description

This pull request implements the following features:

- [x] Add event handler cache implementation
- [x] Renew rendezvous registration at expiration
- [x] Re-discover from rendezvous servers on a set interval
- [x] Renew discovered peer registrations when they expire
- [x] Remove behavior where we add other peers to `external_addresses`
- [x] Add check to not dial ourselves on rendezvous discovery
- [x] Update dialing on rendezvous discovery to only dial peers we
aren't already connected to
- [x] Add rendezvous server `Dialing`, `PeerRegistered`, and
`RegistrationExpired` event debug logs
- [x] Separate `enable_rendezvous` config into
`enable_rendezvous_server` and `enable_rendezvous_client` configs
(server is opt-in, client is opt-out)
- [x] Add `max_connected_peers` config
- [x] Add `rendezvous_registration_ttl` and
`rendezvous_discovery_interval` configs
- [x] Test rendezvous register, discover, and connect
- [x] Test disconnect after rendezvous connect
- [x] Test registration expires and re-registration on expiration
- [x] Test discovered registration expires and rediscovery attempted at
expiration
- [x] Test rediscovery on rendezvous discovery interval
- [x] Add `extract_timestamps_where` and `count_lines_where` test
utilities
- [x] Update libp2p deprecated Kademlia and SwarmBuilder interfaces
- [x] Update integration test fixtures to avoid overlapping ports

## Link to issue

Implements #131.

## Type of change

- [x] New feature (non-breaking change that adds functionality)
- [x] Refactor (non-breaking change that updates existing functionality)
- [x] Comments have been added/updated

## Test plan (required)

We are adding tests to check existing functionality and a test to check
registration renewals.

---------

Co-authored-by: Zeeshan Lakhani <zeeshan.lakhani@gmail.com>
  • Loading branch information
bgins and zeeshanlakhani authored Nov 7, 2023
1 parent 0b97dbe commit 5b5b2ff
Show file tree
Hide file tree
Showing 35 changed files with 1,483 additions and 317 deletions.
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use_flake

export RUST_LOG=homestar=debug,homestar_runtime=debug,libp2p=info,libp2p_gossipsub::behaviour=debug,tarpc=info,tower_http=debug
export RUST_LOG=homestar=debug,homestar_runtime=debug,libp2p=info,libp2p_gossipsub::behaviour=debug,tarpc=info,tower_http=debug,moka=debug
export RUST_BACKTRACE=full
export RUSTFLAGS="--cfg tokio_unstable"
Loading

0 comments on commit 5b5b2ff

Please sign in to comment.