From c84a14ea49efb3ef2374729a5cea0ec4fa130e9f Mon Sep 17 00:00:00 2001 From: Fredrik Date: Tue, 19 Sep 2017 12:24:51 +0200 Subject: [PATCH] Replace Dial with concrete type --- libp2p-tcp-transport/src/lib.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libp2p-tcp-transport/src/lib.rs b/libp2p-tcp-transport/src/lib.rs index 9e98ed42..fa8d9ac8 100644 --- a/libp2p-tcp-transport/src/lib.rs +++ b/libp2p-tcp-transport/src/lib.rs @@ -7,7 +7,7 @@ extern crate futures; use std::io::Error as IoError; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use tokio_core::reactor::Core; -use tokio_core::net::{TcpStream, TcpListener}; +use tokio_core::net::{TcpStream, TcpListener, TcpStreamNew}; use futures::Future; use futures::stream::Stream; use multiaddr::{Multiaddr, Protocol}; @@ -26,14 +26,14 @@ impl Tcp { } impl Transport for Tcp { - /// The raw connection. - type RawConn = TcpStream; + /// The raw connection. + type RawConn = TcpStream; - /// The listener produces incoming connections. - type Listener = Box>; + /// The listener produces incoming connections. + type Listener = Box>; - /// A future which indicates currently dialing to a peer. - type Dial = Box>; + /// A future which indicates currently dialing to a peer. + type Dial = TcpStreamNew; /// Listen on the given multi-addr. /// Returns the address back if it isn't supported. @@ -53,7 +53,7 @@ impl Transport for Tcp { /// or gives back the multiaddress. fn dial(&mut self, addr: Multiaddr) -> Result { if let Ok(socket_addr) = multiaddr_to_socketaddr(&addr) { - Ok(Box::new(TcpStream::connect(&socket_addr, &self.event_loop.handle()))) + Ok(TcpStream::connect(&socket_addr, &self.event_loop.handle())) } else { Err(addr) }