Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(relay): don't close connections upon errors in relay server #4718

Merged
merged 17 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from 12 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
6 changes: 6 additions & 0 deletions protocols/relay/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## 0.17.0 - unreleased

- Don't close connections on protocol failures within the relay-server.
To achieve this, error handling was restructured:
- `libp2p::relay::outbound::stop::FatalUpgradeError` has been removed.
- `libp2p::relay::outbound::stop::{Error, ProtocolViolation}` have been introduced.

See [PR 4718](https://github.com/libp2p/rust-libp2p/pull/4718).
- Fix a rare race condition when making a reservation on a relay that could lead to a failed reservation.
See [PR 4747](https://github.com/libp2p/rust-lib2pp/pulls/4747).

Expand Down
12 changes: 6 additions & 6 deletions protocols/relay/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use libp2p_identity::PeerId;
use libp2p_swarm::behaviour::{ConnectionClosed, FromSwarm};
use libp2p_swarm::{
dummy, ConnectionDenied, ConnectionId, ExternalAddresses, NetworkBehaviour, NotifyHandler,
StreamUpgradeError, THandler, THandlerInEvent, THandlerOutEvent, ToSwarm,
THandler, THandlerInEvent, THandlerOutEvent, ToSwarm,
};
use std::collections::{hash_map, HashMap, HashSet, VecDeque};
use std::num::NonZeroU32;
Expand Down Expand Up @@ -171,14 +171,14 @@ pub enum Event {
/// Accepting an inbound reservation request failed.
ReservationReqAcceptFailed {
src_peer_id: PeerId,
error: inbound_hop::UpgradeError,
error: inbound_hop::Error,
},
thomaseizinger marked this conversation as resolved.
Show resolved Hide resolved
/// An inbound reservation request has been denied.
ReservationReqDenied { src_peer_id: PeerId },
/// Denying an inbound reservation request has failed.
ReservationReqDenyFailed {
src_peer_id: PeerId,
error: inbound_hop::UpgradeError,
error: inbound_hop::Error,
},
/// An inbound reservation has timed out.
ReservationTimedOut { src_peer_id: PeerId },
Expand All @@ -191,7 +191,7 @@ pub enum Event {
CircuitReqDenyFailed {
src_peer_id: PeerId,
dst_peer_id: PeerId,
error: inbound_hop::UpgradeError,
error: inbound_hop::Error,
},
/// An inbound cirucit request has been accepted.
CircuitReqAccepted {
Expand All @@ -202,13 +202,13 @@ pub enum Event {
CircuitReqOutboundConnectFailed {
src_peer_id: PeerId,
dst_peer_id: PeerId,
error: StreamUpgradeError<outbound_stop::CircuitFailedReason>,
error: outbound_stop::Error,
},
/// Accepting an inbound circuit request failed.
CircuitReqAcceptFailed {
src_peer_id: PeerId,
dst_peer_id: PeerId,
error: inbound_hop::UpgradeError,
error: inbound_hop::Error,
},
/// An inbound circuit has closed.
CircuitClosed {
Expand Down
Loading