aboutsummaryrefslogtreecommitdiff
path: root/p2p/src/peer
diff options
context:
space:
mode:
Diffstat (limited to 'p2p/src/peer')
-rw-r--r--p2p/src/peer/mod.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/p2p/src/peer/mod.rs b/p2p/src/peer/mod.rs
index 2068789..6903294 100644
--- a/p2p/src/peer/mod.rs
+++ b/p2p/src/peer/mod.rs
@@ -209,16 +209,17 @@ impl Peer {
self.protocol_ids.write().await.push(protocol_id.clone());
- let selfc = self.clone();
- let proto_idc = protocol_id.clone();
-
- let on_failure = |result: TaskResult<Result<()>>| async move {
- if let TaskResult::Completed(res) = result {
- if res.is_err() {
- error!("protocol {} stopped", proto_idc);
+ let on_failure = {
+ let this = self.clone();
+ let protocol_id = protocol_id.clone();
+ |result: TaskResult<Result<()>>| async move {
+ if let TaskResult::Completed(res) = result {
+ if res.is_err() {
+ error!("protocol {} stopped", protocol_id);
+ }
+ // Send a stop signal to read loop
+ let _ = this.stop_chan.0.try_send(res);
}
- // Send a stop signal to read loop
- let _ = selfc.stop_chan.0.try_send(res);
}
};