gameServer2/src/server/handlers/mod.rs
changeset 13419 81e0ed105f5d
parent 13119 1e39b8749072
child 13444 914f9b970f4d
equal deleted inserted replaced
13418:bb24c3414b0d 13419:81e0ed105f5d
    13 mod inroom;
    13 mod inroom;
    14 
    14 
    15 pub fn handle(server: &mut HWServer, token: usize, message: HWProtocolMessage) {
    15 pub fn handle(server: &mut HWServer, token: usize, message: HWProtocolMessage) {
    16     match message {
    16     match message {
    17         HWProtocolMessage::Ping =>
    17         HWProtocolMessage::Ping =>
    18             server.react(token, vec![SendMe(Pong)]),
    18             server.react(token, vec![Pong.send_self().action()]),
    19         HWProtocolMessage::Quit(Some(msg)) =>
    19         HWProtocolMessage::Quit(Some(msg)) =>
    20             server.react(token, vec![ByeClient("User quit: ".to_string() + &msg)]),
    20             server.react(token, vec![ByeClient("User quit: ".to_string() + &msg)]),
    21         HWProtocolMessage::Quit(None) =>
    21         HWProtocolMessage::Quit(None) =>
    22             server.react(token, vec![ByeClient("User quit".to_string())]),
    22             server.react(token, vec![ByeClient("User quit".to_string())]),
    23         HWProtocolMessage::Malformed => warn!("Malformed/unknown message"),
    23         HWProtocolMessage::Malformed => warn!("Malformed/unknown message"),