From 5b81d2b1b3b8884735354f2e3bab1516d159e1a1 Mon Sep 17 00:00:00 2001 From: Filip Bozic <70634661+fbozic@users.noreply.github.com> Date: Wed, 19 Jun 2024 11:28:00 +0200 Subject: [PATCH] chore(network): compress open stream command handler --- crates/network/src/lib.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/crates/network/src/lib.rs b/crates/network/src/lib.rs index 55fc0dcc1..a05107aa5 100644 --- a/crates/network/src/lib.rs +++ b/crates/network/src/lib.rs @@ -290,14 +290,7 @@ impl EventLoop { let _ = sender.send(Ok(topic)); } Command::OpenStream { peer_id, sender } => { - match self.open_stream(peer_id).await { - Ok(stream) => { - let _ = sender.send(Ok(stream)); - } - Err(err) => { - let _ = sender.send(Err(eyre::eyre!(err))); - } - }; + let _ = sender.send(self.open_stream(peer_id).await.map_err(Into::into)); } Command::PeerCount { sender } => { let _ = sender.send(self.swarm.connected_peers().count());