gameServer2/src/main.rs
changeset 12853 a9d105dc5c95
parent 12852 bd35cb2302b3
child 13119 1e39b8749072
--- a/gameServer2/src/main.rs	Wed Dec 06 23:46:17 2017 +0100
+++ b/gameServer2/src/main.rs	Sat Dec 16 22:58:28 2017 +0100
@@ -11,7 +11,7 @@
 //use std::io::*;
 //use rand::Rng;
 //use std::cmp::Ordering;
-use mio::tcp::*;
+use mio::net::*;
 use mio::*;
 
 mod utils;
@@ -36,24 +36,24 @@
         poll.poll(&mut events, None).unwrap();
 
         for event in events.iter() {
-            if event.kind().is_readable() {
+            if event.readiness() & Ready::readable() == Ready::readable() {
                 match event.token() {
                     utils::SERVER => server.accept(&poll).unwrap(),
                     Token(tok) => server.client_readable(&poll, tok).unwrap(),
                 }
             }
-            if event.kind().is_writable() {
+            if event.readiness() & Ready::writable() == Ready::writable() {
                 match event.token() {
                     utils::SERVER => unreachable!(),
                     Token(tok) => server.client_writable(&poll, tok).unwrap(),
                 }
             }
-            if event.kind().is_hup() || event.kind().is_error() {
-                match event.token() {
-                    utils::SERVER => unreachable!(),
-                    Token(tok) => server.client_error(&poll, tok).unwrap(),
-                }
-            }
+//            if event.kind().is_hup() || event.kind().is_error() {
+//                match event.token() {
+//                    utils::SERVER => unreachable!(),
+//                    Token(tok) => server.client_error(&poll, tok).unwrap(),
+//                }
+//            }
         }
     }
 }