Implement appropriate routing of checker messages
authorunC0Rr
Wed, 11 May 2022 13:48:55 +0200
changeset 15870 3d05bada4799
parent 15869 2839b68a3732
child 15871 ba12545effa0
Implement appropriate routing of checker messages
rust/hedgewars-server/src/core/server.rs
rust/hedgewars-server/src/handlers/checker.rs
rust/hedgewars-server/src/handlers/inlobby.rs
rust/hedgewars-server/src/server/database.rs
--- a/rust/hedgewars-server/src/core/server.rs	Tue May 10 02:59:11 2022 +0300
+++ b/rust/hedgewars-server/src/core/server.rs	Wed May 11 13:48:55 2022 +0200
@@ -258,6 +258,11 @@
             .unwrap_or(false)
     }
 
+    #[inline]
+    pub fn is_checker(&self, client_id: ClientId) -> bool {
+        self.checkers.contains(client_id)
+    }
+
     pub fn add_client(&mut self, client_id: ClientId, data: HwAnteroomClient) {
         if data.is_checker {
             self.checkers.insert(client_id, HwChecker::new(client_id));
--- a/rust/hedgewars-server/src/handlers/checker.rs	Tue May 10 02:59:11 2022 +0300
+++ b/rust/hedgewars-server/src/handlers/checker.rs	Wed May 11 13:48:55 2022 +0200
@@ -3,8 +3,22 @@
 use crate::core::{server::HwServer, types::ClientId};
 use hedgewars_network_protocol::messages::HwProtocolMessage;
 
-pub fn handle(_server: &mut HwServer, _client_id: ClientId, message: HwProtocolMessage) {
+pub fn handle(
+    _server: &mut HwServer,
+    _client_id: ClientId,
+    _response: &mut super::Response,
+    message: HwProtocolMessage,
+) {
     match message {
+        HwProtocolMessage::CheckerReady => {
+            warn!("Unimplemented")
+        }
+        HwProtocolMessage::CheckedOk(info) => {
+            warn!("Unimplemented")
+        }
+        HwProtocolMessage::CheckedFail(message) => {
+            warn!("Unimplemented")
+        }
         _ => warn!("Unknown command"),
     }
 }
--- a/rust/hedgewars-server/src/handlers/inlobby.rs	Tue May 10 02:59:11 2022 +0300
+++ b/rust/hedgewars-server/src/handlers/inlobby.rs	Wed May 11 13:48:55 2022 +0200
@@ -1,5 +1,5 @@
 use super::{common::rnd_reply, strings::*};
-use crate::handlers::actions::ToPendingMessage;
+use crate::handlers::{actions::ToPendingMessage, checker};
 use crate::{
     core::{
         client::HwClient,
--- a/rust/hedgewars-server/src/server/database.rs	Tue May 10 02:59:11 2022 +0300
+++ b/rust/hedgewars-server/src/server/database.rs	Wed May 11 13:48:55 2022 +0200
@@ -106,7 +106,10 @@
             .await
     }
 
-    pub async fn store_achievements(&mut self, achievements: &Achievements) -> mysql_async::Result<()> {
+    pub async fn store_achievements(
+        &mut self,
+        achievements: &Achievements,
+    ) -> mysql_async::Result<()> {
         Ok(())
     }