From f30cc3226d986d41bb1e90720e02ffbf777411a5 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Fri, 13 Dec 2024 15:54:07 +1100 Subject: [PATCH] fix(gateway): don't return error when client disconnected (#7504) When a client disconnects, we clear up the connection on the gateway. There might still be packets arriving from resources that we then cannot route. This isn't worth returning an error. --- rust/connlib/tunnel/src/gateway.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rust/connlib/tunnel/src/gateway.rs b/rust/connlib/tunnel/src/gateway.rs index aad43b5fd..ebb95b921 100644 --- a/rust/connlib/tunnel/src/gateway.rs +++ b/rust/connlib/tunnel/src/gateway.rs @@ -90,10 +90,10 @@ impl GatewayState { return Ok(None); } - let peer = self - .peers - .peer_by_ip_mut(dst) - .context("Couldn't find connection by IP")?; + let Some(peer) = self.peers.peer_by_ip_mut(dst) else { + tracing::debug!(%dst, "Unknown client, perhaps already disconnected?"); + return Ok(None); + }; let cid = peer.id(); let packet = peer