diff --git a/master/src/master_server.rs b/master/src/master_server.rs index 739eb61..2407abf 100644 --- a/master/src/master_server.rs +++ b/master/src/master_server.rs @@ -12,8 +12,7 @@ use log::{error, info, trace, warn}; use thiserror::Error; use xash3d_protocol::filter::{Filter, Version}; use xash3d_protocol::server::Region; -use xash3d_protocol::ServerInfo; -use xash3d_protocol::{game, master, server, Error as ProtocolError}; +use xash3d_protocol::{ServerInfo, admin, game, master, server, Error as ProtocolError}; use crate::config::{self, Config}; @@ -211,6 +210,22 @@ impl MasterServer { } } + if let Ok(p) = admin::Packet::decode(src) { + match p { + admin::Packet::AdminChallenge(p) => { + trace!("{}: recv {:?}", from, p); + let challenge = 0x12345678; // TODO: + let p = master::AdminChallengeResponse::new(challenge); + let mut buf = [0; 64]; + let n = p.encode(&mut buf)?; + self.sock.send_to(&buf[..n], from)?; + } + admin::Packet::AdminCommand(p) => { + trace!("{}: recv {:?}", from, p); + } + } + } + Ok(()) }