Skip to content

Commit

Permalink
fix(request-response): Report dial IO errors to the user
Browse files Browse the repository at this point in the history
This fixes a potential infinite retrying when dialing bad peers. The error is now reported to the user and they should handle it as they see fit for their case.

Pull-Request: libp2p#5429.
  • Loading branch information
oblique authored Jun 4, 2024
1 parent 2c5a979 commit 68301b8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ libp2p-pnet = { version = "0.24.0", path = "transports/pnet" }
libp2p-quic = { version = "0.10.3", path = "transports/quic" }
libp2p-relay = { version = "0.17.2", path = "protocols/relay" }
libp2p-rendezvous = { version = "0.14.0", path = "protocols/rendezvous" }
libp2p-request-response = { version = "0.26.2", path = "protocols/request-response" }
libp2p-request-response = { version = "0.26.3", path = "protocols/request-response" }
libp2p-server = { version = "0.12.7", path = "misc/server" }
libp2p-stream = { version = "0.1.0-alpha.1", path = "protocols/stream" }
libp2p-swarm = { version = "0.44.2", path = "swarm" }
Expand Down
5 changes: 5 additions & 0 deletions protocols/request-response/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.26.3

- Report dial IO errors to the user.
See [PR 5429](https://github.com/libp2p/rust-libp2p/pull/5429).

## 0.26.2

- Deprecate `Behaviour::add_address` in favor of `Swarm::add_peer_address`.
Expand Down
2 changes: 1 addition & 1 deletion protocols/request-response/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-request-response"
edition = "2021"
rust-version = { workspace = true }
description = "Generic Request/Response Protocols"
version = "0.26.2"
version = "0.26.3"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down
9 changes: 4 additions & 5 deletions protocols/request-response/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,10 @@ where
}
StreamUpgradeError::Apply(e) => void::unreachable(e),
StreamUpgradeError::Io(e) => {
tracing::debug!(
"outbound stream for request {} failed: {e}, retrying",
message.request_id
);
self.requested_outbound.push_back(message);
self.pending_events.push_back(Event::OutboundStreamFailed {
request_id: message.request_id,
error: e,
});
}
}
}
Expand Down

0 comments on commit 68301b8

Please sign in to comment.