From 856ebc522773090ae15dfb432287b2069de24a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Fri, 8 Aug 2025 10:06:38 +0100 Subject: [PATCH] return error rather than panic when merging socket during shutdown --- common/client-libs/gateway-client/src/client/mod.rs | 2 +- common/client-libs/gateway-client/src/socket_state.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/client-libs/gateway-client/src/client/mod.rs b/common/client-libs/gateway-client/src/client/mod.rs index 612349315f..de90b3ad35 100644 --- a/common/client-libs/gateway-client/src/client/mod.rs +++ b/common/client-libs/gateway-client/src/client/mod.rs @@ -201,7 +201,7 @@ impl GatewayClient { #[cfg(not(target_arch = "wasm32"))] pub async fn establish_connection(&mut self) -> Result<(), GatewayClientError> { debug!( - "Attemting to establish connection to gateway at: {}", + "Attempting to establish connection to gateway at: {}", self.gateway_address ); let (ws_stream, _) = connect_async( diff --git a/common/client-libs/gateway-client/src/socket_state.rs b/common/client-libs/gateway-client/src/socket_state.rs index b2a1e6ebb0..5489ec3628 100644 --- a/common/client-libs/gateway-client/src/socket_state.rs +++ b/common/client-libs/gateway-client/src/socket_state.rs @@ -337,7 +337,7 @@ impl PartiallyDelegatedHandle { // check if the split stream didn't error out let receive_res = stream_receiver .try_recv() - .expect("stream sender was somehow dropped without sending anything!"); + .map_err(|_| GatewayClientError::ConnectionAbruptlyClosed)?; if let Some(res) = receive_res { let _res = res?;