Skip to content

Commit 461209a

Browse files
fix(hole-punch): don't explicitly close RESERVE stream
Making a reservation on a relay involves a request-response protocol. First we send the `RESERVE` message and then we receive the relay's response. After we've received the response, we have all the information we need and the reservation is valid. It appears that on QUIC, closing the stream can fail if the other party also closed the stream already. This can result in the entire operation failing at the very end even though everything else has succeeded. There is no reason to explicitly close the stream as the remote is not going to read from it beyond the first message anyway. The fact that we receive a response means the remote read our request. This should resolve some of the flakiness that we've been seeing with the hole-punch interop tests. Pull-Request: #4747.
1 parent 3118503 commit 461209a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

protocols/relay/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## 0.17.0 - unreleased
22

3+
- Fix a rare race condition when making a reservation on a relay that could lead to a failed reservation.
4+
See [PR 4747](https://github.com/libp2p/rust-lib2pp/pulls/4747).
5+
36
## 0.16.2
47

58
## 0.16.1

protocols/relay/src/protocol/outbound_hop.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,6 @@ pub(crate) async fn handle_reserve_message_response(
171171
.map(Delay::new)
172172
.ok_or(FatalUpgradeError::InvalidReservationExpiration)?;
173173

174-
substream.close().await?;
175-
176174
Ok(Ok(Reservation {
177175
renewal_timeout,
178176
addrs,

0 commit comments

Comments
 (0)