Skip to content

Commit

Permalink
feat(snownet): minimize delay when roaming (#4246)
Browse files Browse the repository at this point in the history
Currently, we need to wait for the timeout of the current candidate pair
during `reconnect` before we nominate a new one. To speed this up, we
can preemptively invalidate candidates we have previously discovered via
our `Allocation`s, i.e. relay candidates and srflx candidates.
  • Loading branch information
thomaseizinger committed Mar 22, 2024
1 parent e818cb3 commit 3fe8f6d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions rust/connlib/snownet/src/allocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,9 @@ fn update_candidate(
) {
match (maybe_new, &maybe_current) {
(Some(new), Some(current)) if &new != current => {
*maybe_current = Some(new.clone());
events.push_back(CandidateEvent::New(new));
events.push_back(CandidateEvent::New(new.clone()));
events.push_back(CandidateEvent::Invalid(current.clone()));
*maybe_current = Some(new);
}
(Some(new), None) => {
*maybe_current = Some(new.clone());
Expand Down
1 change: 1 addition & 0 deletions rust/connlib/snownet/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ where

let mut agent = IceAgent::new();
agent.set_controlling(true);
agent.set_max_candidate_pairs(300);

let session_key = Secret::new(random());
let ice_creds = agent.local_credentials();
Expand Down

0 comments on commit 3fe8f6d

Please sign in to comment.