fix official server
authoralfadur <mail@none>
Thu, 26 Dec 2019 21:55:51 +0300
changeset 15553 ede5f4ec48f3
parent 15552 a859f08ebb4f
child 15554 f1205f33bf5b
fix official server
rust/hedgewars-server/src/core/server.rs
rust/hedgewars-server/src/handlers/common.rs
rust/hedgewars-server/src/handlers/inroom.rs
rust/hedgewars-server/src/server/database.rs
rust/hedgewars-server/src/server/network.rs
--- a/rust/hedgewars-server/src/core/server.rs	Thu Dec 26 21:04:37 2019 +0300
+++ b/rust/hedgewars-server/src/core/server.rs	Thu Dec 26 21:55:51 2019 +0300
@@ -121,7 +121,6 @@
 #[derive(Debug)]
 pub enum StartGameError {
     NotEnoughClans,
-    NotEnoughTeams,
     NotReady,
     AlreadyInGame,
 }
@@ -251,9 +250,9 @@
 
             #[cfg(feature = "official-server")]
             {
-                client.set_is_registered(info.is_registered);
-                client.set_is_admin(info.is_admin);
-                client.set_is_contributor(info.is_contributor);
+                client.set_is_registered(data.is_registered);
+                client.set_is_admin(data.is_admin);
+                client.set_is_contributor(data.is_contributor);
             }
 
             self.clients.insert(client_id, client);
@@ -653,7 +652,6 @@
                     let new_master = &mut self.server.clients[new_master_id];
                     if new_master.room_id == Some(self.room_id) {
                         self.server.clients[new_master_id].set_is_master(true);
-                        let room = self.room_mut();
                         let old_master_id = self.room().master_id;
 
                         if let Some(master_id) = old_master_id {
--- a/rust/hedgewars-server/src/handlers/common.rs	Thu Dec 26 21:04:37 2019 +0300
+++ b/rust/hedgewars-server/src/handlers/common.rs	Thu Dec 26 21:55:51 2019 +0300
@@ -519,7 +519,6 @@
         Err(StartGameError::NotEnoughClans) => {
             response.warn("The game can't be started with less than two clans!")
         }
-        Err(StartGameError::NotEnoughTeams) => (),
         Err(StartGameError::NotReady) => response.warn("Not all players are ready"),
         Err(StartGameError::AlreadyInGame) => response.warn("The game is already in progress"),
     }
--- a/rust/hedgewars-server/src/handlers/inroom.rs	Thu Dec 26 21:04:37 2019 +0300
+++ b/rust/hedgewars-server/src/handlers/inroom.rs	Thu Dec 26 21:55:51 2019 +0300
@@ -141,7 +141,7 @@
             );
         }
         TeamChat(msg) => {
-            if let Some(ref info) = room.game_info {
+            if room.game_info.is_some() {
                 if let Some(clan_color) = room.find_team_color(client_id) {
                     let engine_msg =
                         to_engine_msg(format!("b{}]{}\x20\x20", client.nick, msg).bytes());
--- a/rust/hedgewars-server/src/server/database.rs	Thu Dec 26 21:04:37 2019 +0300
+++ b/rust/hedgewars-server/src/server/database.rs	Thu Dec 26 21:55:51 2019 +0300
@@ -109,7 +109,7 @@
             if let Some(row) =
                 pool.first_exec(GET_REPLAY_NAME_QUERY, params! { "id" => replay_id })?
             {
-                let filename = from_row_opt::<(String)>(row)?;
+                let filename = from_row_opt::<String>(row)?;
                 Ok(Some(filename))
             } else {
                 Ok(None)
--- a/rust/hedgewars-server/src/server/network.rs	Thu Dec 26 21:04:37 2019 +0300
+++ b/rust/hedgewars-server/src/server/network.rs	Thu Dec 26 21:55:51 2019 +0300
@@ -471,7 +471,7 @@
                         client.send_string(
                             &HwServerMessage::Bye("Ping timeout".to_string()).to_raw_protocol(),
                         );
-                        client.write();
+                        let _res = client.write();
                     }
                     self.operation_failed(
                         poll,
@@ -490,7 +490,7 @@
         while let Some((client_id, result)) = self.io.try_recv() {
             debug!("Handling io result {:?} for client {}", result, client_id);
             let mut response = handlers::Response::new(client_id);
-            handlers::handle_io_result(&mut self.server, client_id, &mut response, result);
+            handlers::handle_io_result(&mut self.server_state, client_id, &mut response, result);
             self.handle_response(response, poll);
         }
         Ok(())
@@ -722,7 +722,7 @@
             .set_private_key_file("ssl/key.pem", SslFiletype::PEM)
             .expect("Cannot find private key file");
         builder.set_options(SslOptions::NO_COMPRESSION);
-        builder.set_options(SslOptions::NO_TLSV1_0);
+        builder.set_options(SslOptions::NO_TLSV1);
         builder.set_options(SslOptions::NO_TLSV1_1);
         builder.set_cipher_list("ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384").unwrap();
         ServerSsl {