Swarm rework (#182)

* Rename Transport::RawConn to Output

* Remove AsyncRead + AsyncWrite bound on Transport::Output

* UpgradedNode now always implements Transport

* Add and tweak modifiers for Transport and ConnectionUpgrade

* Secio upgrade now returns the pubkey in its output

* Add upgrade::apply

* Add Transport::and_then

* Rework the swarm

* Rustfmt

* Fix concerns
This commit is contained in:
Pierre Krieger
2018-05-14 15:55:16 +02:00
committed by GitHub
parent 4382adcbde
commit f787f3d8b8
58 changed files with 833 additions and 526 deletions

View File

@@ -99,10 +99,10 @@ impl<T> Transport for DnsConfig<T>
where
T: Transport + 'static, // TODO: 'static :-/
{
type RawConn = T::RawConn;
type Output = T::Output;
type Listener = T::Listener;
type ListenerUpgrade = T::ListenerUpgrade;
type Dial = Box<Future<Item = (Self::RawConn, Multiaddr), Error = IoError>>;
type Dial = Box<Future<Item = (Self::Output, Multiaddr), Error = IoError>>;
#[inline]
fn listen_on(self, addr: Multiaddr) -> Result<(Self::Listener, Multiaddr), (Self, Multiaddr)> {
@@ -238,10 +238,10 @@ mod tests {
#[derive(Clone)]
struct CustomTransport;
impl Transport for CustomTransport {
type RawConn = <TcpConfig as Transport>::RawConn;
type Output = <TcpConfig as Transport>::Output;
type Listener = <TcpConfig as Transport>::Listener;
type ListenerUpgrade = <TcpConfig as Transport>::ListenerUpgrade;
type Dial = Box<Future<Item = (Self::RawConn, Multiaddr), Error = IoError>>;
type Dial = Box<Future<Item = (Self::Output, Multiaddr), Error = IoError>>;
#[inline]
fn listen_on(