|
|
@ -28,7 +28,7 @@ fn client_read<S, R>(sender: &Sender<ClientPoolAction<R>>, client: &mut Client<S |
|
|
|
println!("client read");
|
|
|
|
let pkts = client.read_pkts();
|
|
|
|
println!("pkts: {:?}", pkts);
|
|
|
|
|
|
|
|
|
|
|
|
for pkt in pkts? {
|
|
|
|
sender.send(ClientPoolAction::Packet(client.id, pkt)).unwrap();
|
|
|
|
}
|
|
|
@ -89,7 +89,7 @@ impl<S, R> ClientPool<S, R> where |
|
|
|
|
|
|
|
fn new_client(&mut self) {
|
|
|
|
let (socket, _addr) = self.listener.accept().unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
let client_id = self.client_id_incr;
|
|
|
|
self.client_id_incr += 1;
|
|
|
|
|
|
|
@ -134,11 +134,11 @@ impl<S, R> ClientPool<S, R> where |
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn io_loop(mut self) {
|
|
|
|
self.poll.register(&self.listener, Token(0), Ready::readable(), PollOpt::edge()).unwrap();
|
|
|
|
self.poll.register(&self.receiver, Token(1), Ready::readable(), PollOpt::edge()).unwrap();
|
|
|
|