Skip to content

Commit

Permalink
Merge branch 'master' into chore/webrtc-websys-feature
Browse files Browse the repository at this point in the history
  • Loading branch information
dariusc93 authored Jan 27, 2025
2 parents a2c1061 + 68ea5b7 commit 74c9e4d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 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 @@ -94,7 +94,7 @@ libp2p-ping = { version = "0.46.0", path = "protocols/ping" }
libp2p-plaintext = { version = "0.43.0", path = "transports/plaintext" }
libp2p-pnet = { version = "0.26.0", path = "transports/pnet" }
libp2p-quic = { version = "0.12.0", path = "transports/quic" }
libp2p-relay = { version = "0.19.0", path = "protocols/relay" }
libp2p-relay = { version = "0.19.1", path = "protocols/relay" }
libp2p-rendezvous = { version = "0.16.0", path = "protocols/rendezvous" }
libp2p-request-response = { version = "0.28.0", path = "protocols/request-response" }
libp2p-server = { version = "0.12.6", path = "misc/server" }
Expand Down
4 changes: 4 additions & 0 deletions protocols/relay/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.19.1

- Remove duplicated forwarding of pending events to connection handler.

## 0.19.0

- Deprecate `void` crate.
Expand Down
2 changes: 1 addition & 1 deletion protocols/relay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-relay"
edition = "2021"
rust-version = { workspace = true }
description = "Communications relaying for libp2p"
version = "0.19.0"
version = "0.19.1"
authors = ["Parity Technologies <[email protected]>", "Max Inden <[email protected]>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down
28 changes: 11 additions & 17 deletions protocols/relay/src/priv_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,14 @@ impl NetworkBehaviour for Behaviour {
local_addr: &Multiaddr,
remote_addr: &Multiaddr,
) -> Result<THandler<Self>, ConnectionDenied> {
let pending_handler_command = self.pending_handler_commands.remove(&connection_id);

if local_addr.is_relayed() {
return Ok(Either::Right(dummy::ConnectionHandler));
}
let mut handler = Handler::new(self.local_peer_id, peer, remote_addr.clone());

if let Some(event) = self.pending_handler_commands.remove(&connection_id) {
if let Some(event) = pending_handler_command {
handler.on_behaviour_event(event)
}

Expand All @@ -188,13 +190,15 @@ impl NetworkBehaviour for Behaviour {
_: Endpoint,
_: PortUse,
) -> Result<THandler<Self>, ConnectionDenied> {
let pending_handler_command = self.pending_handler_commands.remove(&connection_id);

if addr.is_relayed() {
return Ok(Either::Right(dummy::ConnectionHandler));
}

let mut handler = Handler::new(self.local_peer_id, peer, addr.clone());

if let Some(event) = self.pending_handler_commands.remove(&connection_id) {
if let Some(event) = pending_handler_command {
handler.on_behaviour_event(event)
}

Expand All @@ -208,21 +212,11 @@ impl NetworkBehaviour for Behaviour {
connection_id,
endpoint,
..
}) => {
if !endpoint.is_relayed() {
self.directly_connected_peers
.entry(peer_id)
.or_default()
.push(connection_id);
}

if let Some(event) = self.pending_handler_commands.remove(&connection_id) {
self.queued_actions.push_back(ToSwarm::NotifyHandler {
peer_id,
handler: NotifyHandler::One(connection_id),
event: Either::Left(event),
})
}
}) if !endpoint.is_relayed() => {
self.directly_connected_peers
.entry(peer_id)
.or_default()
.push(connection_id);
}
FromSwarm::ConnectionClosed(connection_closed) => {
self.on_connection_closed(connection_closed)
Expand Down

0 comments on commit 74c9e4d

Please sign in to comment.