34 |
34 |
35 loop { |
35 loop { |
36 poll.poll(&mut events, None).unwrap(); |
36 poll.poll(&mut events, None).unwrap(); |
37 |
37 |
38 for event in events.iter() { |
38 for event in events.iter() { |
39 if event.kind().is_readable() { |
39 if event.readiness() & Ready::readable() == Ready::readable() { |
40 match event.token() { |
40 match event.token() { |
41 utils::SERVER => server.accept(&poll).unwrap(), |
41 utils::SERVER => server.accept(&poll).unwrap(), |
42 Token(tok) => server.client_readable(&poll, tok).unwrap(), |
42 Token(tok) => server.client_readable(&poll, tok).unwrap(), |
43 } |
43 } |
44 } |
44 } |
45 if event.kind().is_writable() { |
45 if event.readiness() & Ready::writable() == Ready::writable() { |
46 match event.token() { |
46 match event.token() { |
47 utils::SERVER => unreachable!(), |
47 utils::SERVER => unreachable!(), |
48 Token(tok) => server.client_writable(&poll, tok).unwrap(), |
48 Token(tok) => server.client_writable(&poll, tok).unwrap(), |
49 } |
49 } |
50 } |
50 } |
51 if event.kind().is_hup() || event.kind().is_error() { |
51 // if event.kind().is_hup() || event.kind().is_error() { |
52 match event.token() { |
52 // match event.token() { |
53 utils::SERVER => unreachable!(), |
53 // utils::SERVER => unreachable!(), |
54 Token(tok) => server.client_error(&poll, tok).unwrap(), |
54 // Token(tok) => server.client_error(&poll, tok).unwrap(), |
55 } |
55 // } |
56 } |
56 // } |
57 } |
57 } |
58 } |
58 } |
59 } |
59 } |