rust/hedgewars-server/src/handlers/checker.rs
author alfadur
Mon, 25 Mar 2024 16:05:11 +0300
changeset 16000 d9f1b239b6d7
parent 15882 f185e7367dd3
permissions -rw-r--r--
fix rejoining
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15120
febccab419b1 Apply dos2unix to rust sources
unc0rr
parents: 15075
diff changeset
     1
use log::*;
febccab419b1 Apply dos2unix to rust sources
unc0rr
parents: 15075
diff changeset
     2
15882
f185e7367dd3 Add some work towards having checker work with the new server
unC0Rr
parents: 15848
diff changeset
     3
use crate::core::{server::HwServer, types::CheckerId};
15804
747278149393 Extract network protocol into a separate crate
unc0rr
parents: 15120
diff changeset
     4
use hedgewars_network_protocol::messages::HwProtocolMessage;
15120
febccab419b1 Apply dos2unix to rust sources
unc0rr
parents: 15075
diff changeset
     5
15848
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15831
diff changeset
     6
pub fn handle(
15882
f185e7367dd3 Add some work towards having checker work with the new server
unC0Rr
parents: 15848
diff changeset
     7
    server: &mut HwServer,
f185e7367dd3 Add some work towards having checker work with the new server
unC0Rr
parents: 15848
diff changeset
     8
    checker_id: CheckerId,
15848
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15831
diff changeset
     9
    _response: &mut super::Response,
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15831
diff changeset
    10
    message: HwProtocolMessage,
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15831
diff changeset
    11
) {
15120
febccab419b1 Apply dos2unix to rust sources
unc0rr
parents: 15075
diff changeset
    12
    match message {
15848
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15831
diff changeset
    13
        HwProtocolMessage::CheckerReady => {
15882
f185e7367dd3 Add some work towards having checker work with the new server
unC0Rr
parents: 15848
diff changeset
    14
            server
f185e7367dd3 Add some work towards having checker work with the new server
unC0Rr
parents: 15848
diff changeset
    15
                .get_checker_mut(checker_id)
f185e7367dd3 Add some work towards having checker work with the new server
unC0Rr
parents: 15848
diff changeset
    16
                .map(|c| c.set_is_ready(true));
15848
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15831
diff changeset
    17
            warn!("Unimplemented")
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15831
diff changeset
    18
        }
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15831
diff changeset
    19
        HwProtocolMessage::CheckedOk(info) => {
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15831
diff changeset
    20
            warn!("Unimplemented")
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15831
diff changeset
    21
        }
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15831
diff changeset
    22
        HwProtocolMessage::CheckedFail(message) => {
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15831
diff changeset
    23
            warn!("Unimplemented")
3d05bada4799 Implement appropriate routing of checker messages
unC0Rr
parents: 15831
diff changeset
    24
        }
15120
febccab419b1 Apply dos2unix to rust sources
unc0rr
parents: 15075
diff changeset
    25
        _ => warn!("Unknown command"),
febccab419b1 Apply dos2unix to rust sources
unc0rr
parents: 15075
diff changeset
    26
    }
febccab419b1 Apply dos2unix to rust sources
unc0rr
parents: 15075
diff changeset
    27
}