/// Creates the future for a single RTR TCP listener.
///
/// The future binds to `addr` and then spawns a new `Connection` for every
/// incoming connection on the default Tokio runtime.
Creates the future for a single RTR TCP listener.
The future binds to `addr` and then spawns a new `Connection` for every
incoming connection on the default Tokio runtime.
Creates the future for a single RTR TCP listener . The future binds to ` addr ` and then spawns a new ` Connection ` for every incoming connection on the default Tokio runtime .
fn single_listener(
    addr: SocketAddr,
    session: u16,
    history: OriginsHistory,
    mut dispatch: Dispatch,
    timing: Timing,
) -> impl Future<Item=(), Error=()> {
    TcpListener::bind(&addr).into_future()
    .then(move |res| {
        match res {
            Ok(some) => {
                info!("RTR: Listening on {}.", addr);
                Ok(some)
            }
            Err(err) => {
                error!("Failed to bind RTR listener {}: {}", addr, err);
                Err(())
            }
        }
    })
    .and_then(move |listener| {
        listener.incoming()
        .map_err(|err| {
            error!("Failed to accept RTR connection: {}", err);
        })
        .for_each(move |sock| {
            let notify = dispatch.get_receiver();
            tokio::spawn(
                Connection::new(
                    sock, session, history.clone(), notify,
                    timing,
                )
            )
        })
    })
}
fn single_listener ( addr : SocketAddr , session : u16 , history : OriginsHistory , mut dispatch : Dispatch , timing : Timing , ) -> impl Future < Item = ( ) , Error = ( ) > { TcpListener :: bind ( & addr ) . into_future ( ) . then ( move | res | { match res { Ok ( some ) => { info ! ( " " addr ) ; Ok ( some ) } Err ( err ) => { error ! ( " " addr err ) ; Err ( ( ) ) } } } ) . and_then ( move | listener | { listener . incoming ( ) . map_err ( | err | { error ! ( " " err ) ; } ) . for_each ( move | sock | { let notify = dispatch . get_receiver ( ) ; tokio :: spawn ( Connection :: new ( sock , session , history . clone ( ) , notify , timing , ) ) } ) } ) }
Creates the future for a single RTR TCP listener.
Creates the future for a single RTR TCP listener .
addr
SocketAddr
session
u16
history
OriginsHistory
dispatch
Dispatch
timing
Timing