fix accepting on wrong server socket
authoralfadur
Wed, 01 May 2019 16:37:47 +0300
changeset 14870 ce98c37826a7
parent 14869 9078d787d491
child 14871 0f39f8efbd2e
fix accepting on wrong server socket
rust/hedgewars-server/src/server/handlers/loggingin.rs
rust/hedgewars-server/src/server/network.rs
--- a/rust/hedgewars-server/src/server/handlers/loggingin.rs	Wed May 01 00:13:23 2019 +0200
+++ b/rust/hedgewars-server/src/server/handlers/loggingin.rs	Wed May 01 16:37:47 2019 +0300
@@ -72,7 +72,7 @@
         }
         HWProtocolMessage::Nick(nick) => {
             let client = &mut server.anteroom.clients[client_id];
-            debug!("{} {}", nick, is_name_illegal(&nick));
+
             if client.nick.is_some() {
                 response.add(Error("Nickname already provided.".to_string()).send_self());
                 LoginResult::Unchanged
--- a/rust/hedgewars-server/src/server/network.rs	Wed May 01 00:13:23 2019 +0200
+++ b/rust/hedgewars-server/src/server/network.rs	Wed May 01 16:37:47 2019 +0300
@@ -492,17 +492,20 @@
     }
 
     pub fn accept_client(&mut self, poll: &Poll, server_token: mio::Token) -> io::Result<()> {
-        let (client_socket, addr) = self.listener.accept()?;
-        info!("Connected: {}", addr);
+
 
         match server_token {
             utils::SERVER_TOKEN => {
+                let (client_socket, addr) = self.listener.accept()?;
+                info!("Connected(plaintext): {}", addr);
                 let client_id =
                     self.register_client(poll, self.create_client_socket(client_socket)?, addr);
                 self.init_client(poll, client_id);
             }
             #[cfg(feature = "tls-connections")]
             utils::SECURE_SERVER_TOKEN => {
+                let (client_socket, addr) = self.ssl.listener.accept()?;
+                info!("Connected(TLS): {}", addr);
                 self.register_client(poll, self.create_client_secure_socket(client_socket)?, addr);
             }
             _ => unreachable!(),