|
@ -138,13 +138,10 @@ impl<S, R> ClientPool<S, R> where |
|
|
|
|
|
|
|
|
let mut events = Events::with_capacity(1024);
|
|
|
let mut events = Events::with_capacity(1024);
|
|
|
|
|
|
|
|
|
println!("looping");
|
|
|
|
|
|
loop {
|
|
|
loop {
|
|
|
self.poll.poll(&mut events, None).unwrap();
|
|
|
self.poll.poll(&mut events, None).unwrap();
|
|
|
println!("events! {:?}", events);
|
|
|
|
|
|
|
|
|
|
|
|
for event in &events {
|
|
|
for event in &events {
|
|
|
println!("event! {:?}", event);
|
|
|
|
|
|
match event.token() {
|
|
|
match event.token() {
|
|
|
Token(0) => self.new_client(),
|
|
|
Token(0) => self.new_client(),
|
|
|
Token(1) => self.packet_to_send(),
|
|
|
Token(1) => self.packet_to_send(),
|
|
@ -167,6 +164,7 @@ impl<S, R> ClientPool<S, R> where |
|
|
match client_read(&self.sender, client) {
|
|
|
match client_read(&self.sender, client) {
|
|
|
Ok(()) =>{},
|
|
|
Ok(()) =>{},
|
|
|
Err(err) => {
|
|
|
Err(err) => {
|
|
|
|
|
|
println!("pkt err: {:?}", err);
|
|
|
match err {
|
|
|
match err {
|
|
|
PacketNetworkError::ClientDisconnected => {
|
|
|
PacketNetworkError::ClientDisconnected => {
|
|
|
self.poll.deregister(&client.socket).unwrap();
|
|
|
self.poll.deregister(&client.socket).unwrap();
|
|
|