From 8e07c18178ac43cad3fa8974a243a98d9bc8b896 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 17 Jul 2018 23:26:50 +0200 Subject: [PATCH] Fix panic in identify (#314) --- identify/src/identify_transport.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/identify/src/identify_transport.rs b/identify/src/identify_transport.rs index a50ae4db..bee1d5bb 100644 --- a/identify/src/identify_transport.rs +++ b/identify/src/identify_transport.rs @@ -24,6 +24,7 @@ use libp2p_core::{Multiaddr, MuxedTransport, Transport}; use parking_lot::Mutex; use protocol::{IdentifyInfo, IdentifyOutput, IdentifyProtocolConfig}; use std::collections::hash_map::Entry; +use std::error::Error; use std::io::Error as IoError; use std::sync::Arc; use tokio_io::{AsyncRead, AsyncWrite}; @@ -316,7 +317,7 @@ where F: FnOnce() -> Fut, entry.insert(future.clone()); future::Either::B(future) }, - }.map(|out| (*out).clone()).map_err(|err| panic!()) // FIXME: + }.map(|out| (*out).clone()).map_err(|err| IoError::new(err.kind(), err.description())) } // TODO: test that we receive back what the remote sent us