pub fn run(&mut self) {
        info!("running server on: {}", self.addr);

        let mut events = Events::with_capacity(self.nevent);

        // repeatedly run accepting new connections and moving them to the worker
        loop {
            SERVER_EVENT_LOOP.increment();
            if self.poll.poll(&mut events, self.timeout).is_err() {
                error!("Error polling server");
            }
            SERVER_EVENT_TOTAL.add(events.iter().count() as _);

            // handle all events
            for event in events.iter() {
                match event.token() {
                    LISTENER_TOKEN => {
                        self.do_accept();
                    }
                    WAKER_TOKEN => {
                        while let Ok(signal) = self.signal_queue.try_recv().map(|v| v.into_inner())
                        {
                            match signal {
                                Signal::FlushAll => {}
                                Signal::Shutdown => {
                                    return;
                                }
                            }
                        }
                    }
                    _ => {
                        self.handle_session_event(event);
                    }
                }
            }

            let _ = self.session_queue.wake();
        }
    }
/// Runs the `Listener` in a loop, accepting new sessions and moving them to
/// a worker queue.
Runs the `Listener` in a loop, accepting new sessions and moving them to
a worker queue.
Runs the ` Listener ` in a loop accepting new sessions and moving them to a worker queue .
pub fn run(&mut self) {
        info!("running server on: {}", self.addr);
        let mut events = Events::with_capacity(self.nevent);
        // repeatedly run accepting new connections and moving them to the worker
        loop {
            SERVER_EVENT_LOOP.increment();
            if self.poll.poll(&mut events, self.timeout).is_err() {
                error!("Error polling server");
            }
            SERVER_EVENT_TOTAL.add(events.iter().count() as _);
            // handle all events
            for event in events.iter() {
                match event.token() {
                    LISTENER_TOKEN => {
                        self.do_accept();
                    }
                    WAKER_TOKEN => {
                        while let Ok(signal) = self.signal_queue.try_recv().map(|v| v.into_inner())
                        {
                            match signal {
                                Signal::FlushAll => {}
                                Signal::Shutdown => {
                                    return;
                                }
                            }
                        }
                    }
                    _ => {
                        self.handle_session_event(event);
                    }
                }
            }
            let _ = self.session_queue.wake();
        }
    }
pub fn run ( & mut self ) { info ! ( " " self addr ) ; let mut events = Events :: with_capacity ( self . nevent ) ; // repeatedly run accepting new connections and moving them to the worker loop { SERVER_EVENT_LOOP . increment ( ) ; if self . poll . poll ( & mut events , self . timeout ) . is_err ( ) { error ! ( " " ) ; } SERVER_EVENT_TOTAL . add ( events . iter ( ) . count ( ) as _ ) ; // handle all events for event in events . iter ( ) { match event . token ( ) { LISTENER_TOKEN => { self . do_accept ( ) ; } WAKER_TOKEN => { while let Ok ( signal ) = self . signal_queue . try_recv ( ) . map ( | v | v . into_inner ( ) ) { match signal { Signal :: FlushAll => { } Signal :: Shutdown => { return ; } } } } _ => { self . handle_session_event ( event ) ; } } } let _ = self . session_queue . wake ( ) ; } }
Runs the `Listener` in a loop, accepting new sessions and moving them to
a worker queue.
Runs the ` Listener ` in a loop accepting new sessions and moving them to a worker queue .
&mut self
&mut self