diff options
author | hozan23 <hozan23@karyontech.net> | 2024-06-29 21:16:46 +0200 |
---|---|---|
committer | hozan23 <hozan23@karyontech.net> | 2024-06-29 21:16:46 +0200 |
commit | 5c0abab1b7bf0f2858c451d6f0efc7ca0e138fc6 (patch) | |
tree | 9d64a261ddd289560365b71f5d02d31df6c4a0ec /p2p/src/protocols | |
parent | bcc6721257889f85f57af1b40351540585ffd41d (diff) |
use shadown variables to name clones and place them between {} when spawning new tasks
Diffstat (limited to 'p2p/src/protocols')
-rw-r--r-- | p2p/src/protocols/ping.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/p2p/src/protocols/ping.rs b/p2p/src/protocols/ping.rs index ef1b54e..b800b23 100644 --- a/p2p/src/protocols/ping.rs +++ b/p2p/src/protocols/ping.rs @@ -128,9 +128,11 @@ impl Protocol for PingProtocol { let (pong_chan, pong_chan_recv) = async_channel::bounded(1); let (stop_signal_s, stop_signal) = async_channel::bounded::<Result<()>>(1); - let selfc = self.clone(); self.task_group.spawn( - selfc.clone().ping_loop(pong_chan_recv.clone()), + { + let this = self.clone(); + async move { this.ping_loop(pong_chan_recv.clone()).await } + }, |res| async move { if let TaskResult::Completed(result) = res { let _ = stop_signal_s.send(result).await; |