add some server todos
authoralfadur
Sat, 25 Mar 2023 04:00:30 +0300
changeset 15938 ce47259d5c86
parent 15937 e514ceb5e7d6
child 15939 4a8e6f9d5133
add some server todos
rust/hedgewars-server/src/core/anteroom.rs
rust/hedgewars-server/src/core/client.rs
rust/hedgewars-server/src/core/server.rs
rust/hedgewars-server/src/handlers/common.rs
rust/hedgewars-server/src/handlers/inlobby.rs
rust/hedgewars-server/src/main.rs
rust/hedgewars-server/src/server/demo.rs
rust/hedgewars-server/src/server/io.rs
rust/hedgewars-server/src/server/network.rs
--- a/rust/hedgewars-server/src/core/anteroom.rs	Sat Mar 25 03:29:22 2023 +0300
+++ b/rust/hedgewars-server/src/core/anteroom.rs	Sat Mar 25 04:00:30 2023 +0300
@@ -32,6 +32,7 @@
 
 impl BanCollection {
     fn new() -> Self {
+        todo!("add nick bans");
         Self {
             ban_ips: vec![],
             ban_timeouts: vec![],
--- a/rust/hedgewars-server/src/core/client.rs	Sat Mar 25 03:29:22 2023 +0300
+++ b/rust/hedgewars-server/src/core/client.rs	Sat Mar 25 04:00:30 2023 +0300
@@ -30,6 +30,7 @@
 
 impl HwClient {
     pub fn new(id: ClientId, protocol_number: u16, nick: String) -> HwClient {
+        todo!("add quiet flag");
         HwClient {
             id,
             nick,
--- a/rust/hedgewars-server/src/core/server.rs	Sat Mar 25 03:29:22 2023 +0300
+++ b/rust/hedgewars-server/src/core/server.rs	Sat Mar 25 04:00:30 2023 +0300
@@ -189,6 +189,7 @@
 
 impl HwServer {
     pub fn new(clients_limit: usize, rooms_limit: usize) -> Self {
+        todo!("add reconnection IDs");
         let rooms = Slab::with_capacity(rooms_limit);
         let clients = IndexSlab::with_capacity(clients_limit);
         let checkers = IndexSlab::new();
--- a/rust/hedgewars-server/src/handlers/common.rs	Sat Mar 25 03:29:22 2023 +0300
+++ b/rust/hedgewars-server/src/handlers/common.rs	Sat Mar 25 04:00:30 2023 +0300
@@ -514,6 +514,7 @@
     result: Result<VoteResult, VoteError>,
     response: &mut super::Response,
 ) {
+    todo!("voting result needs to be processed with raised privileges");
     let room_id = room_control.room().id;
     super::common::get_vote_data(room_control.room().id, &result, response);
 
--- a/rust/hedgewars-server/src/handlers/inlobby.rs	Sat Mar 25 03:29:22 2023 +0300
+++ b/rust/hedgewars-server/src/handlers/inlobby.rs	Sat Mar 25 04:00:30 2023 +0300
@@ -26,6 +26,8 @@
 ) {
     use hedgewars_network_protocol::messages::HwProtocolMessage::*;
 
+    todo!("add kick/ban handlers");
+
     match message {
         CreateRoom(name, password) => match server.create_room(client_id, name, password) {
             Err(CreateRoomError::InvalidName) => response.warn(ILLEGAL_ROOM_NAME),
@@ -47,6 +49,7 @@
             }
         },
         Chat(msg) => {
+            todo!("add client quiet flag");
             response.add(
                 ChatMsg {
                     nick: server.client(client_id).nick.clone(),
--- a/rust/hedgewars-server/src/main.rs	Sat Mar 25 03:29:22 2023 +0300
+++ b/rust/hedgewars-server/src/main.rs	Sat Mar 25 04:00:30 2023 +0300
@@ -27,6 +27,7 @@
     let args: Vec<String> = env::args().collect();
     let mut opts = Options::new();
 
+    todo!("Add options for cert paths");
     opts.optopt("p", "port", "port - defaults to 46631", "PORT");
     opts.optflag("h", "help", "help");
     let matches = match opts.parse(&args[1..]) {
--- a/rust/hedgewars-server/src/server/demo.rs	Sat Mar 25 03:29:22 2023 +0300
+++ b/rust/hedgewars-server/src/server/demo.rs	Sat Mar 25 04:00:30 2023 +0300
@@ -135,6 +135,7 @@
         let mut teams = vec![];
         let mut hog_index = 7usize;
 
+        todo!("read messages from file");
         let messages = vec![];
 
         while let Some(cmd) = read_command(&mut reader, &mut buffer)? {
--- a/rust/hedgewars-server/src/server/io.rs	Sat Mar 25 03:29:22 2023 +0300
+++ b/rust/hedgewars-server/src/server/io.rs	Sat Mar 25 04:00:30 2023 +0300
@@ -24,6 +24,8 @@
         let (core_tx, io_rx) = mpsc::channel();
         let (io_tx, core_rx) = mpsc::channel();
 
+        todo!("convert into an IO task");
+
         /*let mut db = Database::new("localhost");
 
         thread::spawn(move || {
--- a/rust/hedgewars-server/src/server/network.rs	Sat Mar 25 03:29:22 2023 +0300
+++ b/rust/hedgewars-server/src/server/network.rs	Sat Mar 25 04:00:30 2023 +0300
@@ -188,6 +188,7 @@
                             }
                         }
                         Err(e) => {
+                            todo!("send cmdline errors");
                             sender.send(Error(format!("{}", e))).await;
                             if matches!(e, ProtocolError::Timeout) {
                                 Self::write(&mut self.stream, Bytes::from(HwServerMessage::Bye("Ping timeout".to_string()).to_raw_protocol())).await;
@@ -276,6 +277,8 @@
             }
         }
 
+        todo!("add the DB task");
+        todo!("add certfile watcher task");
         loop {
             #[cfg(not(feature = "tls-connections"))]
             tokio::select! {