From 6f137e7485bb17e135cad2a47c9b9b4fad1b3f09 Mon Sep 17 00:00:00 2001 From: Ted Steen Date: Mon, 6 Jan 2025 12:40:01 +0000 Subject: [PATCH 1/2] Warn instead of panic on send failure --- matchbox_socket/src/webrtc_socket/socket.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matchbox_socket/src/webrtc_socket/socket.rs b/matchbox_socket/src/webrtc_socket/socket.rs index ccb5ab8c..94a5eb10 100644 --- a/matchbox_socket/src/webrtc_socket/socket.rs +++ b/matchbox_socket/src/webrtc_socket/socket.rs @@ -314,7 +314,7 @@ impl WebRtcChannel { /// # Panics /// Panics if the socket future is dropped. pub fn send(&mut self, packet: Packet, peer: PeerId) { - self.try_send(packet, peer).expect("Send failed"); + let _ = self.try_send(packet, peer).inspect_err(|err| log::warn!("Send failed: {err:?}")); } } From eb3cadd17a854e4ca3072a040153114915ea253b Mon Sep 17 00:00:00 2001 From: Ted Steen Date: Mon, 6 Jan 2025 14:09:19 +0000 Subject: [PATCH 2/2] formatting --- matchbox_socket/src/webrtc_socket/socket.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/matchbox_socket/src/webrtc_socket/socket.rs b/matchbox_socket/src/webrtc_socket/socket.rs index 94a5eb10..0225c140 100644 --- a/matchbox_socket/src/webrtc_socket/socket.rs +++ b/matchbox_socket/src/webrtc_socket/socket.rs @@ -314,7 +314,9 @@ impl WebRtcChannel { /// # Panics /// Panics if the socket future is dropped. pub fn send(&mut self, packet: Packet, peer: PeerId) { - let _ = self.try_send(packet, peer).inspect_err(|err| log::warn!("Send failed: {err:?}")); + let _ = self + .try_send(packet, peer) + .inspect_err(|err| log::warn!("Send failed: {err:?}")); } }