Skip to content

Commit

Permalink
{core,swarm}/: Don't require Transport: Clone and take &mut (libp…
Browse files Browse the repository at this point in the history
…2p#2529)

Previously `libp2p-swarm` required a `Transport` to be `Clone`. Methods
on `Transport`, e.g. `Transport::dial` would take ownership, requiring
e.g. a `Clone::clone` before calling `Transport::dial`.

The requirement of `Transport` to be `Clone` is no longer needed in
`libp2p-swarm`. E.g.  concurrent dialing can be done without a clone per
dial.

This commit removes the requirement of `Clone` for `Transport` in
`libp2p-swarm`. As a follow-up methods on `Transport` no longer take
ownership, but instead a mutable reference (`&mut self`).

On the one hand this simplifies `libp2p-swarm`, on the other it
simplifies implementations of `Transport`.
  • Loading branch information
mxinden authored Apr 6, 2022
1 parent c8af6d8 commit 886b148
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 0.4.0 [unreleased]

- Update to `libp2p-core` `v0.33.0`.

- Update to `libp2p-swarm` `v0.36.0`.

- Update to `libp2p-request-response` `v0.18.0`.

# 0.3.0

- Update to `libp2p-swarm` `v0.35.0`.
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-autonat"
edition = "2021"
rust-version = "1.56.1"
description = "NAT and firewall detection for libp2p"
version = "0.3.0"
version = "0.4.0"
authors = ["David Craven <david@craven.ch>", "Elena Frank <elena.frank@protonmail.com>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand All @@ -18,9 +18,9 @@ async-trait = "0.1"
futures = "0.3"
futures-timer = "3.0"
instant = "0.1"
libp2p-core = { version = "0.32.0", path = "../../core", default-features = false }
libp2p-swarm = { version = "0.35.0", path = "../../swarm" }
libp2p-request-response = { version = "0.17.0", path = "../request-response" }
libp2p-core = { version = "0.33.0", path = "../../core", default-features = false }
libp2p-swarm = { version = "0.36.0", path = "../../swarm" }
libp2p-request-response = { version = "0.18.0", path = "../request-response" }
log = "0.4"
rand = "0.8"
prost = "0.10"
Expand Down

0 comments on commit 886b148

Please sign in to comment.