pub fn run(mut self) -> io::Result<()> {
        loop {
            loop {
                match self.connections.try_recv() {
                    Ok(stream) => {
                        let id = self.players.len();
                        self.players.push(Player { conn: stream });
                        self.handle_new_player(id);
                    }
                    Err(TryRecvError::Empty) => break,
                    Err(TryRecvError::Disconnected) => {
                        info!("tcp listener thread exited, killing server");
                        return Ok(());
                    }
                }
            }

            // Sleep for 1/60th of a second
            // FIXME Put in a proper rate limit
            thread::sleep(Duration::new(0, 1000000 / 60));

            // self.world_manager.update_world(self.player.get_camera().position);
        }
    }
/// Runs the server's main loop.
Runs the server's main loop.
Runs the server ' s main loop .
pub fn run(mut self) -> io::Result<()> {
        loop {
            loop {
                match self.connections.try_recv() {
                    Ok(stream) => {
                        let id = self.players.len();
                        self.players.push(Player { conn: stream });
                        self.handle_new_player(id);
                    }
                    Err(TryRecvError::Empty) => break,
                    Err(TryRecvError::Disconnected) => {
                        info!("tcp listener thread exited, killing server");
                        return Ok(());
                    }
                }
            }
            // Sleep for 1/60th of a second
            // FIXME Put in a proper rate limit
            thread::sleep(Duration::new(0, 1000000 / 60));
            // self.world_manager.update_world(self.player.get_camera().position);
        }
    }
pub fn run ( mut self ) -> io :: Result < ( ) > { loop { loop { match self . connections . try_recv ( ) { Ok ( stream ) => { let id = self . players . len ( ) ; self . players . push ( Player { conn : stream } ) ; self . handle_new_player ( id ) ; } Err ( TryRecvError :: Empty ) => break , Err ( TryRecvError :: Disconnected ) => { info ! ( " " ) ; return Ok ( ( ) ) ; } } } // Sleep for 1/60th of a second // FIXME Put in a proper rate limit thread :: sleep ( Duration :: new ( 0 , 1000000 / 60 ) ) ; // self.world_manager.update_world(self.player.get_camera().position); } }
Runs the server's main loop.
Runs the server ' s main loop .
mut self