Skip to content

Commit

Permalink
end connection on send failure
Browse files Browse the repository at this point in the history
  • Loading branch information
simbleau committed Sep 12, 2023
1 parent 557c09b commit ec6d833
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions matchbox_socket/src/webrtc_socket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use futures::{future::Either, stream::FuturesUnordered, Future, FutureExt, Strea
use futures_channel::mpsc::{TrySendError, UnboundedReceiver, UnboundedSender};
use futures_timer::Delay;
use futures_util::select;
use log::{debug, error, warn};
use log::{debug, warn};
use matchbox_protocol::PeerId;
use messages::*;
pub(crate) use socket::MessageLoopChannels;
Expand Down Expand Up @@ -220,12 +220,7 @@ async fn message_loop<M: Messenger>(
.get_mut(&peer)
.expect("couldn't find data channel for peer")
.get_mut(channel_index).unwrap_or_else(|| panic!("couldn't find data channel with index {channel_index}"));
if let Err(e) = data_channel.send(packet) {
// Peer is defunct, remove them
error!("peer {peer} has become defunct: {e:?}");
// TODO: do we need to remove the peer or do anything special here?
};

data_channel.send(packet)?;
}
Some((_, None)) | None => {
// Receiver end of outgoing message channel closed,
Expand Down

0 comments on commit ec6d833

Please sign in to comment.