100 match message { |
100 match message { |
101 HWProtocolMessage::Ping => { |
101 HWProtocolMessage::Ping => { |
102 response.add(Pong.send_self()); |
102 response.add(Pong.send_self()); |
103 } |
103 } |
104 HWProtocolMessage::Quit(Some(msg)) => { |
104 HWProtocolMessage::Quit(Some(msg)) => { |
105 //ByeClient("User quit: ".to_string() + &msg) |
105 common::remove_client(server, response, "User quit: ".to_string() + &msg); |
106 } |
106 } |
107 HWProtocolMessage::Quit(None) => { |
107 HWProtocolMessage::Quit(None) => { |
108 //ByeClient("User quit".to_string()) |
108 common::remove_client(server, response, "User quit".to_string()); |
109 } |
109 } |
110 HWProtocolMessage::Malformed => warn!("Malformed/unknown message"), |
110 HWProtocolMessage::Malformed => warn!("Malformed/unknown message"), |
111 HWProtocolMessage::Empty => warn!("Empty message"), |
111 HWProtocolMessage::Empty => warn!("Empty message"), |
112 _ => match server.clients[client_id].room_id { |
112 _ => match server.clients[client_id].room_id { |
113 None => loggingin::handle(server, client_id, response, message), |
113 None => loggingin::handle(server, client_id, response, message), |
116 } |
116 } |
117 Some(id) => inroom::handle(server, client_id, response, id, message), |
117 Some(id) => inroom::handle(server, client_id, response, id, message), |
118 }, |
118 }, |
119 } |
119 } |
120 } |
120 } |
|
121 |
|
122 pub fn handle_client_loss(server: &mut HWServer, client_id: ClientId, response: &mut Response) { |
|
123 common::remove_client(server, response, "Connection reset".to_string()); |
|
124 } |