mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-27 00:31:35 +00:00
Move swarm and protocols handler into swarm crate. (#1188)
Move swarm and protocols handler into swarm crate.
This commit is contained in:
@ -22,9 +22,22 @@ use crate::listen_handler::IdentifyListenHandler;
|
||||
use crate::periodic_id_handler::{PeriodicIdHandler, PeriodicIdHandlerEvent};
|
||||
use crate::protocol::{IdentifyInfo, IdentifySender, IdentifySenderFuture};
|
||||
use futures::prelude::*;
|
||||
use libp2p_core::protocols_handler::{ProtocolsHandler, ProtocolsHandlerSelect, ProtocolsHandlerUpgrErr};
|
||||
use libp2p_core::swarm::{ConnectedPoint, NetworkBehaviour, NetworkBehaviourAction, PollParameters};
|
||||
use libp2p_core::{Multiaddr, PeerId, PublicKey, either::EitherOutput, upgrade::Negotiated};
|
||||
use libp2p_core::{
|
||||
ConnectedPoint,
|
||||
Multiaddr,
|
||||
PeerId,
|
||||
PublicKey,
|
||||
either::EitherOutput,
|
||||
upgrade::Negotiated
|
||||
};
|
||||
use libp2p_swarm::{
|
||||
NetworkBehaviour,
|
||||
NetworkBehaviourAction,
|
||||
PollParameters,
|
||||
ProtocolsHandler,
|
||||
ProtocolsHandlerSelect,
|
||||
ProtocolsHandlerUpgrErr
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
use std::{collections::HashMap, collections::VecDeque, io};
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
@ -227,11 +240,11 @@ mod tests {
|
||||
upgrade::{self, OutboundUpgradeExt, InboundUpgradeExt},
|
||||
muxing::StreamMuxer,
|
||||
Multiaddr,
|
||||
Swarm,
|
||||
Transport
|
||||
};
|
||||
use libp2p_tcp::TcpConfig;
|
||||
use libp2p_secio::SecioConfig;
|
||||
use libp2p_swarm::Swarm;
|
||||
use libp2p_mplex::MplexConfig;
|
||||
use rand::Rng;
|
||||
use std::{fmt, io};
|
||||
|
@ -20,15 +20,13 @@
|
||||
|
||||
use crate::protocol::{IdentifySender, IdentifyProtocolConfig};
|
||||
use futures::prelude::*;
|
||||
use libp2p_core::{
|
||||
protocols_handler::{
|
||||
KeepAlive,
|
||||
SubstreamProtocol,
|
||||
ProtocolsHandler,
|
||||
ProtocolsHandlerEvent,
|
||||
ProtocolsHandlerUpgrErr
|
||||
},
|
||||
upgrade::{DeniedUpgrade, InboundUpgrade, OutboundUpgrade, Negotiated}
|
||||
use libp2p_core::upgrade::{DeniedUpgrade, InboundUpgrade, OutboundUpgrade, Negotiated};
|
||||
use libp2p_swarm::{
|
||||
KeepAlive,
|
||||
SubstreamProtocol,
|
||||
ProtocolsHandler,
|
||||
ProtocolsHandlerEvent,
|
||||
ProtocolsHandlerUpgrErr
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
|
@ -20,15 +20,13 @@
|
||||
|
||||
use crate::protocol::{RemoteInfo, IdentifyProtocolConfig};
|
||||
use futures::prelude::*;
|
||||
use libp2p_core::{
|
||||
protocols_handler::{
|
||||
KeepAlive,
|
||||
SubstreamProtocol,
|
||||
ProtocolsHandler,
|
||||
ProtocolsHandlerEvent,
|
||||
ProtocolsHandlerUpgrErr
|
||||
},
|
||||
upgrade::{DeniedUpgrade, OutboundUpgrade}
|
||||
use libp2p_core::upgrade::{DeniedUpgrade, OutboundUpgrade};
|
||||
use libp2p_swarm::{
|
||||
KeepAlive,
|
||||
SubstreamProtocol,
|
||||
ProtocolsHandler,
|
||||
ProtocolsHandlerEvent,
|
||||
ProtocolsHandlerUpgrErr
|
||||
};
|
||||
use std::{io, marker::PhantomData, time::Duration};
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
|
@ -23,7 +23,8 @@ use crate::structs_proto;
|
||||
use futures::{future::{self, FutureResult}, Async, AsyncSink, Future, Poll, Sink, Stream};
|
||||
use futures::try_ready;
|
||||
use libp2p_core::{
|
||||
Multiaddr, PublicKey,
|
||||
Multiaddr,
|
||||
PublicKey,
|
||||
upgrade::{InboundUpgrade, OutboundUpgrade, UpgradeInfo, Negotiated}
|
||||
};
|
||||
use log::{debug, trace};
|
||||
|
Reference in New Issue
Block a user