Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions src/transport/webrtc/opening.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand All @@ -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");
Expand Down
Loading