Skip to content

Commit 693d7b7

Browse files
authored
feat(swarm): Show task spawn paths in tokio-console
This PR adds `#[track_caller]` on all `spawn` wrappers. Pull-Request: #5465.
1 parent 36c2f94 commit 693d7b7

File tree

8 files changed

+13
-3
lines changed

8 files changed

+13
-3
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ libp2p-gossipsub = { version = "0.46.2", path = "protocols/gossipsub" }
8686
libp2p-identify = { version = "0.45.0", path = "protocols/identify" }
8787
libp2p-identity = { version = "0.2.9" }
8888
libp2p-kad = { version = "0.46.0", path = "protocols/kad" }
89-
libp2p-mdns = { version = "0.45.1", path = "protocols/mdns" }
89+
libp2p-mdns = { version = "0.45.2", path = "protocols/mdns" }
9090
libp2p-memory-connection-limits = { version = "0.2.0", path = "misc/memory-connection-limits" }
9191
libp2p-metrics = { version = "0.14.2", path = "misc/metrics" }
9292
libp2p-mplex = { version = "0.41.0", path = "muxers/mplex" }

protocols/mdns/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.45.2
2+
3+
- Add `#[track_caller]` on all `spawn` wrappers.
4+
See [PR 5465](https://github.com/libp2p/rust-libp2p/pull/5465).
5+
16
## 0.45.1
27

38
- Ensure `Multiaddr` handled and returned by `Behaviour` are `/p2p` terminated.

protocols/mdns/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "libp2p-mdns"
33
edition = "2021"
44
rust-version = { workspace = true }
5-
version = "0.45.1"
5+
version = "0.45.2"
66
description = "Implementation of the libp2p mDNS discovery method"
77
authors = ["Parity Technologies <[email protected]>"]
88
license = "MIT"

protocols/mdns/src/behaviour.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pub trait Provider: 'static {
5555
/// Create a new instance of the `IfWatcher` type.
5656
fn new_watcher() -> Result<Self::Watcher, std::io::Error>;
5757

58+
#[track_caller]
5859
fn spawn(task: impl Future<Output = ()> + Send + 'static) -> Self::TaskHandle;
5960
}
6061

swarm/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
- Use `web-time` instead of `instant`.
77
See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347).
8+
- Add `#[track_caller]` on all `spawn` wrappers.
9+
See [PR 5465](https://github.com/libp2p/rust-libp2p/pull/5465).
810

911
## 0.44.2
1012

swarm/src/connection/pool.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ impl ExecSwitch {
7070
}
7171
}
7272

73+
#[track_caller]
7374
fn spawn(&mut self, task: impl Future<Output = ()> + Send + 'static) {
7475
let task = task.boxed();
7576

swarm/src/executor.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use std::{future::Future, pin::Pin};
1111
/// > about running `Future`s on a separate task.
1212
pub trait Executor {
1313
/// Run the given future in the background until it ends.
14+
#[track_caller]
1415
fn exec(&self, future: Pin<Box<dyn Future<Output = ()> + Send>>);
1516
}
1617

0 commit comments

Comments
 (0)