pub fn run_until<F>(self, shutdown_signal: F) -> ::Result<()>
        where F: Future<Item = (), Error = ()>,
    {
        let Server { protocol, new_service, mut core, listener, shutdown_timeout } = self;
        let handle = core.handle();

        // Mini future to track the number of active services
        let info = Rc::new(RefCell::new(Info {
            active: 0,
            blocker: None,
        }));

        // Future for our server's execution
        let srv = listener.incoming().for_each(|(socket, addr)| {
            let s = NotifyService {
                inner: try!(new_service.new_service()),
                info: Rc::downgrade(&info),
            };
            info.borrow_mut().active += 1;
            protocol.bind_connection(&handle, socket, addr, s);
            Ok(())
        });

        // for now, we don't care if the shutdown signal succeeds or errors
        // as long as it resolves, we will shutdown.
        let shutdown_signal = shutdown_signal.then(|_| Ok(()));

        // Main execution of the server. Here we use `select` to wait for either
        // `incoming` or `f` to resolve. We know that `incoming` will never
        // resolve with a success (it's infinite) so we're actually just waiting
        // for an error or for `f`, our shutdown signal.
        //
        // When we get a shutdown signal (`Ok`) then we drop the TCP listener to
        // stop accepting incoming connections.
        match core.run(shutdown_signal.select(srv)) {
            Ok(((), _incoming)) => {}
            Err((e, _other)) => return Err(e.into()),
        }

        // Ok we've stopped accepting new connections at this point, but we want
        // to give existing connections a chance to clear themselves out. Wait
        // at most `shutdown_timeout` time before we just return clearing
        // everything out.
        //
        // Our custom `WaitUntilZero` will resolve once all services constructed
        // here have been destroyed.
        let timeout = try!(Timeout::new(shutdown_timeout, &handle));
        let wait = WaitUntilZero { info: info.clone() };
        match core.run(wait.select(timeout)) {
            Ok(_) => Ok(()),
            Err((e, _)) => return Err(e.into())
        }
    }
/// Execute this server until the given future, `shutdown_signal`, resolves.
///
/// This method, like `run` above, is used to execute this HTTP server. The
/// difference with `run`, however, is that this method allows for shutdown
/// in a graceful fashion. The future provided is interpreted as a signal to
/// shut down the server when it resolves.
///
/// This method will block the current thread executing the HTTP server.
/// When the `shutdown_signal` has resolved then the TCP listener will be
/// unbound (dropped). The thread will continue to block for a maximum of
/// `shutdown_timeout` time waiting for active connections to shut down.
/// Once the `shutdown_timeout` elapses or all active connections are
/// cleaned out then this method will return.
Execute this server until the given future, `shutdown_signal`, resolves.
This method, like `run` above, is used to execute this HTTP server. The
difference with `run`, however, is that this method allows for shutdown
in a graceful fashion. The future provided is interpreted as a signal to
shut down the server when it resolves.

This method will block the current thread executing the HTTP server.
When the `shutdown_signal` has resolved then the TCP listener will be
unbound (dropped). The thread will continue to block for a maximum of
`shutdown_timeout` time waiting for active connections to shut down.
Once the `shutdown_timeout` elapses or all active connections are
cleaned out then this method will return.
Execute this server until the given future ` shutdown_signal ` resolves . This method like ` run ` above is used to execute this HTTP server . The difference with ` run ` however is that this method allows for shutdown in a graceful fashion . The future provided is interpreted as a signal to shut down the server when it resolves . This method will block the current thread executing the HTTP server . When the ` shutdown_signal ` has resolved then the TCP listener will be unbound ( dropped ) . The thread will continue to block for a maximum of ` shutdown_timeout ` time waiting for active connections to shut down . Once the ` shutdown_timeout ` elapses or all active connections are cleaned out then this method will return .
pub fn run_until<F>(self, shutdown_signal: F) -> ::Result<()>
        where F: Future<Item = (), Error = ()>,
    {
        let Server { protocol, new_service, mut core, listener, shutdown_timeout } = self;
        let handle = core.handle();
        // Mini future to track the number of active services
        let info = Rc::new(RefCell::new(Info {
            active: 0,
            blocker: None,
        }));
        // Future for our server's execution
        let srv = listener.incoming().for_each(|(socket, addr)| {
            let s = NotifyService {
                inner: try!(new_service.new_service()),
                info: Rc::downgrade(&info),
            };
            info.borrow_mut().active += 1;
            protocol.bind_connection(&handle, socket, addr, s);
            Ok(())
        });
        // for now, we don't care if the shutdown signal succeeds or errors
        // as long as it resolves, we will shutdown.
        let shutdown_signal = shutdown_signal.then(|_| Ok(()));
        // Main execution of the server. Here we use `select` to wait for either
        // `incoming` or `f` to resolve. We know that `incoming` will never
        // resolve with a success (it's infinite) so we're actually just waiting
        // for an error or for `f`, our shutdown signal.
        //
        // When we get a shutdown signal (`Ok`) then we drop the TCP listener to
        // stop accepting incoming connections.
        match core.run(shutdown_signal.select(srv)) {
            Ok(((), _incoming)) => {}
            Err((e, _other)) => return Err(e.into()),
        }
        // Ok we've stopped accepting new connections at this point, but we want
        // to give existing connections a chance to clear themselves out. Wait
        // at most `shutdown_timeout` time before we just return clearing
        // everything out.
        //
        // Our custom `WaitUntilZero` will resolve once all services constructed
        // here have been destroyed.
        let timeout = try!(Timeout::new(shutdown_timeout, &handle));
        let wait = WaitUntilZero { info: info.clone() };
        match core.run(wait.select(timeout)) {
            Ok(_) => Ok(()),
            Err((e, _)) => return Err(e.into())
        }
    }
pub fn run_until < F > ( self , shutdown_signal : F ) -> :: Result < ( ) > where F : Future < Item = ( ) , Error = ( ) > , { let Server { protocol , new_service , mut core , listener , shutdown_timeout } = self ; let handle = core . handle ( ) ; // Mini future to track the number of active services let info = Rc :: new ( RefCell :: new ( Info { active : 0 , blocker : None , } ) ) ; // Future for our server's execution let srv = listener . incoming ( ) . for_each ( | ( socket , addr ) | { let s = NotifyService { inner : try ! ( new_service new_service ( ) ) , info : Rc :: downgrade ( & info ) , } ; info . borrow_mut ( ) . active += 1 ; protocol . bind_connection ( & handle , socket , addr , s ) ; Ok ( ( ) ) } ) ; // for now, we don't care if the shutdown signal succeeds or errors // as long as it resolves, we will shutdown. let shutdown_signal = shutdown_signal . then ( | _ | Ok ( ( ) ) ) ; // Main execution of the server. Here we use `select` to wait for either // `incoming` or `f` to resolve. We know that `incoming` will never // resolve with a success (it's infinite) so we're actually just waiting // for an error or for `f`, our shutdown signal. // // When we get a shutdown signal (`Ok`) then we drop the TCP listener to // stop accepting incoming connections. match core . run ( shutdown_signal . select ( srv ) ) { Ok ( ( ( ) , _incoming ) ) => { } Err ( ( e , _other ) ) => return Err ( e . into ( ) ) , } // Ok we've stopped accepting new connections at this point, but we want // to give existing connections a chance to clear themselves out. Wait // at most `shutdown_timeout` time before we just return clearing // everything out. // // Our custom `WaitUntilZero` will resolve once all services constructed // here have been destroyed. let timeout = try ! ( Timeout new ( shutdown_timeout handle ) ) ; let wait = WaitUntilZero { info : info . clone ( ) } ; match core . run ( wait . select ( timeout ) ) { Ok ( _ ) => Ok ( ( ) ) , Err ( ( e , _ ) ) => return Err ( e . into ( ) ) } }
Execute this server until the given future, `shutdown_signal`, resolves.
Execute this server until the given future ` shutdown_signal ` resolves .
self
shutdown_signal
F
self
shutdown_signal
F