From c53553cd26aa8f248fe7daf474010bed87ba455d Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Thu, 15 Feb 2024 12:55:46 +1100 Subject: [PATCH] feat(snownet): timeout connections without a handshake after 20 seconds (#3633) It was discovered by @conectado that this timeout needs to be longer than 10 seconds. --- rust/connlib/snownet/src/node.rs | 2 +- rust/connlib/snownet/tests/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/connlib/snownet/src/node.rs b/rust/connlib/snownet/src/node.rs index 8025fc25a..d3effd9ae 100644 --- a/rust/connlib/snownet/src/node.rs +++ b/rust/connlib/snownet/src/node.rs @@ -543,7 +543,7 @@ where .initial .iter() .filter_map(|(id, conn)| { - (now.duration_since(conn.created_at) >= Duration::from_secs(10)).then_some(*id) + (now.duration_since(conn.created_at) >= Duration::from_secs(20)).then_some(*id) }) .collect::>(); diff --git a/rust/connlib/snownet/tests/lib.rs b/rust/connlib/snownet/tests/lib.rs index 674e1b20b..81a2a8700 100644 --- a/rust/connlib/snownet/tests/lib.rs +++ b/rust/connlib/snownet/tests/lib.rs @@ -14,7 +14,7 @@ fn connection_times_out_after_10_seconds() { ClientNode::::new(StaticSecret::random_from_rng(rand::thread_rng()), start); let _ = alice.new_connection(1, HashSet::new(), HashSet::new()); - alice.handle_timeout(start + Duration::from_secs(10)); + alice.handle_timeout(start + Duration::from_secs(20)); assert_eq!(alice.poll_event().unwrap(), Event::ConnectionFailed(1)); }