gameServer2/src/server/server.rs
changeset 12129 07972a8c2433
parent 12128 f50876f3eff8
child 12136 e25a82ce2374
equal deleted inserted replaced
12128:f50876f3eff8 12129:07972a8c2433
    29         poll.register(&self.listener, utils::SERVER, Ready::readable(),
    29         poll.register(&self.listener, utils::SERVER, Ready::readable(),
    30                       PollOpt::edge())
    30                       PollOpt::edge())
    31     }
    31     }
    32 
    32 
    33     pub fn accept(&mut self, poll: &Poll) -> io::Result<()> {
    33     pub fn accept(&mut self, poll: &Poll) -> io::Result<()> {
    34         let (sock, addr) = self.listener.accept().unwrap();
    34         let (sock, addr) = self.listener.accept()?;
    35         println!("Connected: {}", addr);
    35         println!("Connected: {}", addr);
    36 
    36 
    37         let client = HWClient::new(sock);
    37         let client = HWClient::new(sock);
    38         let token = self.clients.insert(client)
    38         let token = self.clients.insert(client)
    39             .ok().expect("could not add connection to slab");
    39             .ok().expect("could not add connection to slab");