Skip to content

Commit 18d8b44

Browse files
authored
Merge branch 'master' into chore/correct-linting
2 parents 318a1b6 + e244b98 commit 18d8b44

File tree

8 files changed

+23
-8
lines changed

8 files changed

+23
-8
lines changed

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ libp2p-identity = { version = "0.2.10" }
8686
libp2p-kad = { version = "0.47.0", path = "protocols/kad" }
8787
libp2p-mdns = { version = "0.47.0", path = "protocols/mdns" }
8888
libp2p-memory-connection-limits = { version = "0.4.0", path = "misc/memory-connection-limits" }
89-
libp2p-metrics = { version = "0.16.0", path = "misc/metrics" }
89+
libp2p-metrics = { version = "0.16.1", path = "misc/metrics" }
9090
libp2p-mplex = { version = "0.43.1", path = "muxers/mplex" }
9191
libp2p-noise = { version = "0.46.0", path = "transports/noise" }
9292
libp2p-perf = { version = "0.4.0", path = "protocols/perf" }
9393
libp2p-ping = { version = "0.46.0", path = "protocols/ping" }
9494
libp2p-plaintext = { version = "0.43.0", path = "transports/plaintext" }
9595
libp2p-pnet = { version = "0.26.0", path = "transports/pnet" }
9696
libp2p-quic = { version = "0.12.0", path = "transports/quic" }
97-
libp2p-relay = { version = "0.19.1", path = "protocols/relay" }
97+
libp2p-relay = { version = "0.20.0", path = "protocols/relay" }
9898
libp2p-rendezvous = { version = "0.16.0", path = "protocols/rendezvous" }
9999
libp2p-request-response = { version = "0.28.1", path = "protocols/request-response" }
100100
libp2p-server = { version = "0.12.6", path = "misc/server" }

misc/metrics/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.16.1
2+
- Add `ReservationClosed` as a relay metric.
3+
See [PR 5869](https://github.com/libp2p/rust-libp2p/pull/5869).
4+
15
## 0.16.0
26

37
<!-- Update to libp2p-core v0.43.0 -->

misc/metrics/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "libp2p-metrics"
33
edition = "2021"
44
rust-version = { workspace = true }
55
description = "Metrics for libp2p"
6-
version = "0.16.0"
6+
version = "0.16.1"
77
authors = ["Max Inden <[email protected]>"]
88
license = "MIT"
99
repository = "https://github.com/libp2p/rust-libp2p"

misc/metrics/src/relay.rs

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ enum EventType {
5454
ReservationReqAcceptFailed,
5555
ReservationReqDenied,
5656
ReservationReqDenyFailed,
57+
ReservationClosed,
5758
ReservationTimedOut,
5859
CircuitReqDenied,
5960
CircuitReqDenyFailed,
@@ -76,6 +77,7 @@ impl From<&libp2p_relay::Event> for EventType {
7677
libp2p_relay::Event::ReservationReqDenyFailed { .. } => {
7778
EventType::ReservationReqDenyFailed
7879
}
80+
libp2p_relay::Event::ReservationClosed { .. } => EventType::ReservationClosed,
7981
libp2p_relay::Event::ReservationTimedOut { .. } => EventType::ReservationTimedOut,
8082
libp2p_relay::Event::CircuitReqDenied { .. } => EventType::CircuitReqDenied,
8183
#[allow(deprecated)]

protocols/relay/CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
## 0.19.1
1+
## 0.20.0
22

33
- Remove duplicated forwarding of pending events to connection handler.
4+
- Emit `relay::Event::ReservationClosed` when an active reservation is dropped due to the connection closing.
5+
See [PR 5869](https://github.com/libp2p/rust-libp2p/pull/5869).
46

57
## 0.19.0
68

protocols/relay/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "libp2p-relay"
33
edition = "2021"
44
rust-version = { workspace = true }
55
description = "Communications relaying for libp2p"
6-
version = "0.19.1"
6+
version = "0.20.0"
77
authors = ["Parity Technologies <[email protected]>", "Max Inden <[email protected]>"]
88
license = "MIT"
99
repository = "https://github.com/libp2p/rust-libp2p"

protocols/relay/src/behaviour.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ pub enum Event {
193193
src_peer_id: PeerId,
194194
error: inbound_hop::Error,
195195
},
196+
/// A reservation has been closed.
197+
ReservationClosed { src_peer_id: PeerId },
196198
/// An inbound reservation has timed out.
197199
ReservationTimedOut { src_peer_id: PeerId },
198200
/// An inbound circuit request has been denied.
@@ -277,7 +279,12 @@ impl Behaviour {
277279
}: ConnectionClosed,
278280
) {
279281
if let hash_map::Entry::Occupied(mut peer) = self.reservations.entry(peer_id) {
280-
peer.get_mut().remove(&connection_id);
282+
if peer.get_mut().remove(&connection_id) {
283+
self.queued_actions
284+
.push_back(ToSwarm::GenerateEvent(Event::ReservationClosed {
285+
src_peer_id: peer_id,
286+
}));
287+
}
281288
if peer.get().is_empty() {
282289
peer.remove();
283290
}

0 commit comments

Comments
 (0)