diff --git a/src/transport/webrtc/opening.rs b/src/transport/webrtc/opening.rs index ba6e2af7..5d0d46af 100644 --- a/src/transport/webrtc/opening.rs +++ b/src/transport/webrtc/opening.rs @@ -409,8 +409,15 @@ impl OpeningWebRtcConnection { continue; } - // TODO: https://github.com/paritytech/litep2p/issues/350 no expect - self.on_noise_channel_open().expect("to succeed"); + if let Err(error) = self.on_noise_channel_open() { + tracing::debug!( + target: LOG_TARGET, + connection_id = ?self.connection_id, + ?error, + "noise channel open failed", + ); + return WebRtcEvent::ConnectionClosed; + } } Event::ChannelData(data) => { tracing::trace!( @@ -428,8 +435,18 @@ impl OpeningWebRtcConnection { continue; } - // TODO: https://github.com/paritytech/litep2p/issues/350 no expect - return self.on_noise_channel_data(data.data).expect("to succeed"); + match self.on_noise_channel_data(data.data) { + Ok(event) => return event, + Err(error) => { + tracing::debug!( + target: LOG_TARGET, + connection_id = ?self.connection_id, + ?error, + "noise channel data handling failed", + ); + return WebRtcEvent::ConnectionClosed; + } + } } Event::ChannelClose(channel_id) => { tracing::debug!(target: LOG_TARGET, ?channel_id, "channel closed");