Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 3 additions & 7 deletions p2p/src/authenticated/actors/peer/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,9 @@ impl<E: Spawner + Clock + ReasonablyRealtime + Rng + CryptoRng + Metrics, C: Pub
// If the channel handler is closed, we log an error but don't
// close the peer (as other channels may still be open).
let sender = senders.get_mut(&data.channel).unwrap();
if let Err(e) = sender
.send((peer.clone(), data.message))
.await
.map_err(|_| Error::ChannelClosed(data.channel))
{
debug!(err=?e, "failed to send message to client");
}
let _ = sender.send((peer.clone(), data.message)).await.inspect_err(
|e| debug!(err=?e, channel=data.channel, "failed to send message to client"),
);
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions p2p/src/authenticated/actors/peer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,4 @@ pub enum Error {
MessageDropped,
#[error("invalid channel")]
InvalidChannel,
#[error("channel closed: {0}")]
ChannelClosed(u32),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was unused, so I removed it. Alternatively, we could keep this error and add an error field.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change makes sense 👍

}
Loading