From 48dc15f2159e83f38601dd561d5c2a519d5bfc76 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Wed, 13 Mar 2024 01:06:28 +1100 Subject: [PATCH] chore(snownet): extract constant for handshake timeout (#4091) --- rust/connlib/snownet/src/node.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust/connlib/snownet/src/node.rs b/rust/connlib/snownet/src/node.rs index da633a94d..733cbea7a 100644 --- a/rust/connlib/snownet/src/node.rs +++ b/rust/connlib/snownet/src/node.rs @@ -38,6 +38,9 @@ const HANDSHAKE_RATE_LIMIT: u64 = 100; /// How long we will at most wait for a candidate from the remote. const CANDIDATE_TIMEOUT: Duration = Duration::from_secs(10); +/// How long we will at most wait for an [`Answer`] from the remote. +const HANDSHAKE_TIMEOUT: Duration = Duration::from_secs(20); + const MAX_UDP_SIZE: usize = (1 << 16) - 1; /// Manages a set of wireguard connections for a server. @@ -1213,7 +1216,7 @@ impl InitialConnection { where TId: fmt::Display, { - if now.duration_since(self.created_at) >= Duration::from_secs(20) { + if now.duration_since(self.created_at) >= HANDSHAKE_TIMEOUT { tracing::info!(%id, "Connection setup timed out (no answer received)"); self.is_failed = true; }