mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-20 21:36:31 +00:00
Switch libp2p-core to edition 2018 (#819)
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "libp2p-core"
|
name = "libp2p-core"
|
||||||
|
edition = "2018"
|
||||||
description = "Core traits and structs of libp2p"
|
description = "Core traits and structs of libp2p"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
|
@ -53,37 +53,6 @@
|
|||||||
//! outbound substream, etc. See the `protocols_handler` trait.
|
//! outbound substream, etc. See the `protocols_handler` trait.
|
||||||
//!
|
//!
|
||||||
|
|
||||||
extern crate bs58;
|
|
||||||
extern crate bytes;
|
|
||||||
extern crate fnv;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate futures;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate log;
|
|
||||||
extern crate multihash;
|
|
||||||
extern crate multistream_select;
|
|
||||||
extern crate parking_lot;
|
|
||||||
extern crate protobuf;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate quick_error;
|
|
||||||
extern crate rw_stream_sink;
|
|
||||||
extern crate smallvec;
|
|
||||||
extern crate tokio_executor;
|
|
||||||
extern crate tokio_io;
|
|
||||||
extern crate tokio_timer;
|
|
||||||
extern crate void;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
extern crate rand;
|
|
||||||
#[cfg(test)]
|
|
||||||
extern crate tokio;
|
|
||||||
#[cfg(test)]
|
|
||||||
extern crate tokio_codec;
|
|
||||||
#[cfg(test)]
|
|
||||||
#[macro_use]
|
|
||||||
extern crate assert_matches;
|
|
||||||
#[cfg(test)]
|
|
||||||
extern crate tokio_mock_task;
|
|
||||||
|
|
||||||
/// Multi-address re-export.
|
/// Multi-address re-export.
|
||||||
pub extern crate multiaddr;
|
pub extern crate multiaddr;
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
//! implementation of `StreamMuxer` to control everything that happens on the wire.
|
//! implementation of `StreamMuxer` to control everything that happens on the wire.
|
||||||
|
|
||||||
use fnv::FnvHashMap;
|
use fnv::FnvHashMap;
|
||||||
use futures::{future, prelude::*};
|
use futures::{future, prelude::*, try_ready};
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use std::io::{Error as IoError, ErrorKind as IoErrorKind, Read, Write};
|
use std::io::{Error as IoError, ErrorKind as IoErrorKind, Read, Write};
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
@ -518,12 +518,13 @@ impl<'a, TInEvent> PeerMut<'a, TInEvent> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use futures::future::{self};
|
use assert_matches::assert_matches;
|
||||||
use tests::dummy_muxer::{DummyMuxer, DummyConnectionState};
|
use futures::future;
|
||||||
use tests::dummy_handler::{Handler, InEvent, OutEvent, HandlerState};
|
use crate::tests::dummy_muxer::{DummyMuxer, DummyConnectionState};
|
||||||
|
use crate::tests::dummy_handler::{Handler, InEvent, OutEvent, HandlerState};
|
||||||
use tokio::runtime::current_thread::Runtime;
|
use tokio::runtime::current_thread::Runtime;
|
||||||
use tokio::runtime::Builder;
|
use tokio::runtime::Builder;
|
||||||
use nodes::NodeHandlerEvent;
|
use crate::nodes::NodeHandlerEvent;
|
||||||
use std::{io, sync::Arc};
|
use std::{io, sync::Arc};
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
use muxing::StreamMuxer;
|
use crate::muxing::StreamMuxer;
|
||||||
use nodes::node::{NodeEvent, NodeStream, Substream};
|
use crate::nodes::node::{NodeEvent, NodeStream, Substream};
|
||||||
use futures::{prelude::*, stream::Fuse};
|
use futures::{prelude::*, stream::Fuse};
|
||||||
use std::{error, fmt, io};
|
use std::{error, fmt, io};
|
||||||
|
|
||||||
@ -358,9 +358,10 @@ where THandlerErr: error::Error + 'static
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use assert_matches::assert_matches;
|
||||||
use tokio::runtime::current_thread;
|
use tokio::runtime::current_thread;
|
||||||
use tests::dummy_muxer::{DummyMuxer, DummyConnectionState};
|
use crate::tests::dummy_muxer::{DummyMuxer, DummyConnectionState};
|
||||||
use tests::dummy_handler::{Handler, HandlerState, InEvent, OutEvent, TestHandledNode};
|
use crate::tests::dummy_handler::{Handler, HandlerState, InEvent, OutEvent, TestHandledNode};
|
||||||
use std::{io, marker::PhantomData};
|
use std::{io, marker::PhantomData};
|
||||||
|
|
||||||
struct TestBuilder {
|
struct TestBuilder {
|
||||||
|
@ -498,15 +498,16 @@ mod tests {
|
|||||||
|
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
|
use assert_matches::assert_matches;
|
||||||
use futures::future::{self, FutureResult};
|
use futures::future::{self, FutureResult};
|
||||||
use futures::sync::mpsc::{UnboundedReceiver, UnboundedSender};
|
use futures::sync::mpsc::{UnboundedReceiver, UnboundedSender};
|
||||||
use nodes::handled_node::NodeHandlerEvent;
|
use crate::nodes::handled_node::NodeHandlerEvent;
|
||||||
use tests::dummy_handler::{Handler, HandlerState, InEvent, OutEvent, TestHandledNode};
|
use crate::tests::dummy_handler::{Handler, HandlerState, InEvent, OutEvent, TestHandledNode};
|
||||||
use tests::dummy_muxer::{DummyMuxer, DummyConnectionState};
|
use crate::tests::dummy_muxer::{DummyMuxer, DummyConnectionState};
|
||||||
use tokio::runtime::Builder;
|
use tokio::runtime::Builder;
|
||||||
use tokio::runtime::current_thread::Runtime;
|
use tokio::runtime::current_thread::Runtime;
|
||||||
use void::Void;
|
use void::Void;
|
||||||
use PeerId;
|
use crate::PeerId;
|
||||||
|
|
||||||
type TestNodeTask = NodeTask<
|
type TestNodeTask = NodeTask<
|
||||||
FutureResult<(PeerId, DummyMuxer), io::Error>,
|
FutureResult<(PeerId, DummyMuxer), io::Error>,
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use void::Void;
|
use void::Void;
|
||||||
use {Multiaddr, Transport};
|
use crate::{Multiaddr, Transport};
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
|
|
||||||
/// Implementation of `futures::Stream` that allows listening on multiaddresses.
|
/// Implementation of `futures::Stream` that allows listening on multiaddresses.
|
||||||
@ -277,13 +277,14 @@ mod tests {
|
|||||||
extern crate libp2p_tcp;
|
extern crate libp2p_tcp;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use transport;
|
use crate::transport;
|
||||||
|
use assert_matches::assert_matches;
|
||||||
use tokio::runtime::current_thread::Runtime;
|
use tokio::runtime::current_thread::Runtime;
|
||||||
use std::io;
|
use std::io;
|
||||||
use futures::{future::{self}, stream};
|
use futures::{future::{self}, stream};
|
||||||
use tests::dummy_transport::{DummyTransport, ListenerState};
|
use crate::tests::dummy_transport::{DummyTransport, ListenerState};
|
||||||
use tests::dummy_muxer::DummyMuxer;
|
use crate::tests::dummy_muxer::DummyMuxer;
|
||||||
use PeerId;
|
use crate::PeerId;
|
||||||
|
|
||||||
fn set_listener_state(ls: &mut ListenersStream<DummyTransport>, idx: usize, state: ListenerState) {
|
fn set_listener_state(ls: &mut ListenersStream<DummyTransport>, idx: usize, state: ListenerState) {
|
||||||
let l = &mut ls.listeners[idx];
|
let l = &mut ls.listeners[idx];
|
||||||
@ -293,8 +294,8 @@ mod tests {
|
|||||||
let stream = stream::poll_fn(|| future::err(io::Error::new(io::ErrorKind::Other, "oh noes")).poll() );
|
let stream = stream::poll_fn(|| future::err(io::Error::new(io::ErrorKind::Other, "oh noes")).poll() );
|
||||||
Box::new(stream)
|
Box::new(stream)
|
||||||
}
|
}
|
||||||
ListenerState::Ok(async) => {
|
ListenerState::Ok(r#async) => {
|
||||||
match async {
|
match r#async {
|
||||||
Async::NotReady => {
|
Async::NotReady => {
|
||||||
let stream = stream::poll_fn(|| Ok(Async::NotReady));
|
let stream = stream::poll_fn(|| Ok(Async::NotReady));
|
||||||
Box::new(stream)
|
Box::new(stream)
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
use muxing;
|
use crate::muxing;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::io::Error as IoError;
|
use std::io::Error as IoError;
|
||||||
@ -379,11 +379,11 @@ where
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod node_stream {
|
mod node_stream {
|
||||||
use super::NodeStream;
|
use super::{NodeEvent, NodeStream};
|
||||||
|
use crate::tests::dummy_muxer::{DummyMuxer, DummyConnectionState};
|
||||||
|
use assert_matches::assert_matches;
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
use tokio_mock_task::MockTask;
|
use tokio_mock_task::MockTask;
|
||||||
use super::NodeEvent;
|
|
||||||
use tests::dummy_muxer::{DummyMuxer, DummyConnectionState};
|
|
||||||
|
|
||||||
fn build_node_stream() -> NodeStream<DummyMuxer, Vec<u8>> {
|
fn build_node_stream() -> NodeStream<DummyMuxer, Vec<u8>> {
|
||||||
let muxer = DummyMuxer::new();
|
let muxer = DummyMuxer::new();
|
||||||
|
@ -925,7 +925,7 @@ where TTrans: Transport
|
|||||||
.find(|(_, a)| a.id == reach_id)
|
.find(|(_, a)| a.id == reach_id)
|
||||||
.map(|(p, _)| p.clone());
|
.map(|(p, _)| p.clone());
|
||||||
if let Some(peer_id) = out_reach_peer_id {
|
if let Some(peer_id) = out_reach_peer_id {
|
||||||
let mut attempt = reach_attempts.out_reach_attempts.remove(&peer_id)
|
let attempt = reach_attempts.out_reach_attempts.remove(&peer_id)
|
||||||
.expect("out_reach_peer_id is a key that is grabbed from out_reach_attempts");
|
.expect("out_reach_peer_id is a key that is grabbed from out_reach_attempts");
|
||||||
|
|
||||||
let num_remain = attempt.next_attempts.len();
|
let num_remain = attempt.next_attempts.len();
|
||||||
@ -1317,14 +1317,15 @@ where
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use std::sync::Arc;
|
use crate::tests::dummy_transport::DummyTransport;
|
||||||
|
use crate::tests::dummy_handler::{Handler, HandlerState, InEvent, OutEvent};
|
||||||
|
use crate::tests::dummy_transport::ListenerState;
|
||||||
|
use crate::tests::dummy_muxer::{DummyMuxer, DummyConnectionState};
|
||||||
|
use crate::nodes::NodeHandlerEvent;
|
||||||
|
use assert_matches::assert_matches;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
use std::sync::Arc;
|
||||||
use tokio::runtime::{Builder, Runtime};
|
use tokio::runtime::{Builder, Runtime};
|
||||||
use tests::dummy_transport::DummyTransport;
|
|
||||||
use tests::dummy_handler::{Handler, HandlerState, InEvent, OutEvent};
|
|
||||||
use tests::dummy_transport::ListenerState;
|
|
||||||
use tests::dummy_muxer::{DummyMuxer, DummyConnectionState};
|
|
||||||
use nodes::NodeHandlerEvent;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn query_transport() {
|
fn query_transport() {
|
||||||
|
@ -18,10 +18,11 @@
|
|||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
use crate::PublicKey;
|
||||||
use bs58;
|
use bs58;
|
||||||
|
use quick_error::quick_error;
|
||||||
use multihash;
|
use multihash;
|
||||||
use std::{fmt, str::FromStr};
|
use std::{fmt, str::FromStr};
|
||||||
use PublicKey;
|
|
||||||
|
|
||||||
/// Identifier of a peer of the network.
|
/// Identifier of a peer of the network.
|
||||||
///
|
///
|
||||||
@ -188,7 +189,7 @@ impl FromStr for PeerId {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use rand::random;
|
use rand::random;
|
||||||
use {PeerId, PublicKey};
|
use crate::{PeerId, PublicKey};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn peer_id_is_public_key() {
|
fn peer_id_is_public_key() {
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
use PeerId;
|
use crate::{keys_proto, PeerId};
|
||||||
use keys_proto;
|
use log::debug;
|
||||||
use protobuf::{self, Message};
|
use protobuf::{self, Message};
|
||||||
use std::io::{Error as IoError, ErrorKind as IoErrorKind};
|
use std::io::{Error as IoError, ErrorKind as IoErrorKind};
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ impl PublicKey {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use rand::random;
|
use rand::random;
|
||||||
use PublicKey;
|
use crate::PublicKey;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn key_into_protobuf_then_back() {
|
fn key_into_protobuf_then_back() {
|
||||||
|
@ -24,8 +24,8 @@ use std::io::{self, Error as IoError};
|
|||||||
|
|
||||||
use super::dummy_muxer::DummyMuxer;
|
use super::dummy_muxer::DummyMuxer;
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
use muxing::SubstreamRef;
|
use crate::muxing::SubstreamRef;
|
||||||
use nodes::handled_node::{HandledNode, NodeHandler, NodeHandlerEndpoint, NodeHandlerEvent};
|
use crate::nodes::handled_node::{HandledNode, NodeHandler, NodeHandlerEndpoint, NodeHandlerEvent};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
//! desired way when testing other components.
|
//! desired way when testing other components.
|
||||||
|
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
use muxing::{Shutdown, StreamMuxer};
|
use crate::muxing::{Shutdown, StreamMuxer};
|
||||||
use std::io::Error as IoError;
|
use std::io::Error as IoError;
|
||||||
|
|
||||||
/// Substream type
|
/// Substream type
|
||||||
|
@ -28,8 +28,8 @@ use futures::{
|
|||||||
stream,
|
stream,
|
||||||
};
|
};
|
||||||
use std::io;
|
use std::io;
|
||||||
use {Multiaddr, PeerId, Transport};
|
use crate::{Multiaddr, PeerId, Transport};
|
||||||
use tests::dummy_muxer::DummyMuxer;
|
use crate::tests::dummy_muxer::DummyMuxer;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub(crate) enum ListenerState {
|
pub(crate) enum ListenerState {
|
||||||
@ -78,9 +78,9 @@ impl Transport for DummyTransport {
|
|||||||
{
|
{
|
||||||
let addr2 = addr.clone();
|
let addr2 = addr.clone();
|
||||||
match self.listener_state {
|
match self.listener_state {
|
||||||
ListenerState::Ok(async) => {
|
ListenerState::Ok(r#async) => {
|
||||||
let tupelize = move |stream| (future::ok(stream), addr.clone());
|
let tupelize = move |stream| (future::ok(stream), addr.clone());
|
||||||
Ok(match async {
|
Ok(match r#async {
|
||||||
Async::NotReady => {
|
Async::NotReady => {
|
||||||
let stream = stream::poll_fn(|| Ok(Async::NotReady)).map(tupelize);
|
let stream = stream::poll_fn(|| Ok(Async::NotReady)).map(tupelize);
|
||||||
(Box::new(stream), addr2)
|
(Box::new(stream), addr2)
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use {Multiaddr, PeerId, PublicKey};
|
use crate::{Multiaddr, PeerId, PublicKey};
|
||||||
|
|
||||||
/// Storage for the network topology.
|
/// Storage for the network topology.
|
||||||
///
|
///
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
use crate::{nodes::raw_swarm::ConnectedPoint, transport::Transport};
|
use crate::{nodes::raw_swarm::ConnectedPoint, transport::Transport};
|
||||||
use futures::{future::Either, prelude::*};
|
use futures::{future::Either, prelude::*, try_ready};
|
||||||
use multiaddr::Multiaddr;
|
use multiaddr::Multiaddr;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ use multiaddr::Multiaddr;
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::io::Error as IoError;
|
use std::io::Error as IoError;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use transport::Transport;
|
use crate::transport::Transport;
|
||||||
|
|
||||||
/// See the `Transport::boxed` method.
|
/// See the `Transport::boxed` method.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
use either::{EitherListenStream, EitherOutput, EitherFuture};
|
use crate::either::{EitherListenStream, EitherOutput, EitherFuture};
|
||||||
use multiaddr::Multiaddr;
|
use multiaddr::Multiaddr;
|
||||||
use transport::Transport;
|
use crate::transport::Transport;
|
||||||
|
|
||||||
/// Struct returned by `or_transport()`.
|
/// Struct returned by `or_transport()`.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
use crate::{nodes::raw_swarm::ConnectedPoint, transport::Transport};
|
use crate::{nodes::raw_swarm::ConnectedPoint, transport::Transport};
|
||||||
use futures::prelude::*;
|
use futures::{prelude::*, try_ready};
|
||||||
use multiaddr::Multiaddr;
|
use multiaddr::Multiaddr;
|
||||||
|
|
||||||
/// See `Transport::map`.
|
/// See `Transport::map`.
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
use futures::prelude::*;
|
use crate::transport::Transport;
|
||||||
|
use futures::{prelude::*, try_ready};
|
||||||
use multiaddr::Multiaddr;
|
use multiaddr::Multiaddr;
|
||||||
use std::io::Error as IoError;
|
use std::io::Error as IoError;
|
||||||
use transport::Transport;
|
|
||||||
|
|
||||||
/// See `Transport::map_err`.
|
/// See `Transport::map_err`.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
@ -24,7 +24,7 @@ use multiaddr::{Protocol, Multiaddr};
|
|||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use rw_stream_sink::RwStreamSink;
|
use rw_stream_sink::RwStreamSink;
|
||||||
use std::{io, sync::Arc};
|
use std::{io, sync::Arc};
|
||||||
use Transport;
|
use crate::Transport;
|
||||||
|
|
||||||
/// Builds a new pair of `Transport`s. The dialer can reach the listener by dialing `/memory`.
|
/// Builds a new pair of `Transport`s. The dialer can reach the listener by dialing `/memory`.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -24,7 +24,8 @@
|
|||||||
// TODO: add example
|
// TODO: add example
|
||||||
|
|
||||||
use crate::{Multiaddr, Transport};
|
use crate::{Multiaddr, Transport};
|
||||||
use futures::{Async, Future, Poll, Stream};
|
use futures::{try_ready, Async, Future, Poll, Stream};
|
||||||
|
use log::debug;
|
||||||
use std::io::{Error as IoError, ErrorKind as IoErrorKind};
|
use std::io::{Error as IoError, ErrorKind as IoErrorKind};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use tokio_timer::Timeout;
|
use tokio_timer::Timeout;
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
use futures::{future::Either, prelude::*};
|
|
||||||
use multiaddr::Multiaddr;
|
|
||||||
use crate::{
|
use crate::{
|
||||||
transport::Transport,
|
transport::Transport,
|
||||||
upgrade::{
|
upgrade::{
|
||||||
@ -32,6 +30,8 @@ use crate::{
|
|||||||
InboundUpgradeApply
|
InboundUpgradeApply
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
use futures::{future::Either, prelude::*, try_ready};
|
||||||
|
use multiaddr::Multiaddr;
|
||||||
use tokio_io::{AsyncRead, AsyncWrite};
|
use tokio_io::{AsyncRead, AsyncWrite};
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
use crate::nodes::ConnectedPoint;
|
use crate::nodes::ConnectedPoint;
|
||||||
use crate::upgrade::{UpgradeInfo, InboundUpgrade, OutboundUpgrade, UpgradeError, ProtocolName};
|
use crate::upgrade::{UpgradeInfo, InboundUpgrade, OutboundUpgrade, UpgradeError, ProtocolName};
|
||||||
use futures::{future::Either, prelude::*};
|
use futures::{future::Either, prelude::*};
|
||||||
|
use log::debug;
|
||||||
use multistream_select::{self, DialerSelectFuture, ListenerSelectFuture};
|
use multistream_select::{self, DialerSelectFuture, ListenerSelectFuture};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use tokio_io::{AsyncRead, AsyncWrite};
|
use tokio_io::{AsyncRead, AsyncWrite};
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
use futures::prelude::*;
|
|
||||||
use crate::upgrade::{InboundUpgrade, OutboundUpgrade, UpgradeInfo};
|
use crate::upgrade::{InboundUpgrade, OutboundUpgrade, UpgradeInfo};
|
||||||
|
use futures::{prelude::*, try_ready};
|
||||||
|
|
||||||
/// Wraps around an upgrade and applies a closure to the output.
|
/// Wraps around an upgrade and applies a closure to the output.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
Reference in New Issue
Block a user