Browse Source

master: debug log invalid packets

ipv6
Denis Drakhnia 1 year ago
parent
commit
05b447a750
  1. 13
      master/src/master_server.rs

13
master/src/master_server.rs

@ -9,10 +9,11 @@ use std::time::Instant;
use blake2b_simd::Params; use blake2b_simd::Params;
use fastrand::Rng; use fastrand::Rng;
use log::{error, info, trace, warn}; use log::{debug, error, info, trace, warn};
use thiserror::Error; use thiserror::Error;
use xash3d_protocol::filter::{Filter, FilterFlags, Version}; use xash3d_protocol::filter::{Filter, FilterFlags, Version};
use xash3d_protocol::server::Region; use xash3d_protocol::server::Region;
use xash3d_protocol::types::Str;
use xash3d_protocol::{admin, game, master, server, Error as ProtocolError, ServerInfo}; use xash3d_protocol::{admin, game, master, server, Error as ProtocolError, ServerInfo};
use crate::config::{self, Config}; use crate::config::{self, Config};
@ -223,9 +224,7 @@ impl MasterServer {
trace!("{}: recv {:?}", from, p); trace!("{}: recv {:?}", from, p);
} }
} }
} } else if let Ok(p) = game::Packet::decode(src) {
if let Ok(p) = game::Packet::decode(src) {
match p { match p {
game::Packet::QueryServers(p) => { game::Packet::QueryServers(p) => {
trace!("{}: recv {:?}", from, p); trace!("{}: recv {:?}", from, p);
@ -265,9 +264,7 @@ impl MasterServer {
self.sock.send_to(&buf[..n], from)?; self.sock.send_to(&buf[..n], from)?;
} }
} }
} } else if let Ok(p) = admin::Packet::decode(self.hash.len, src) {
if let Ok(p) = admin::Packet::decode(self.hash.len, src) {
let now = self.now(); let now = self.now();
if let Some(e) = self.admin_limit.get(from.ip()) { if let Some(e) = self.admin_limit.get(from.ip()) {
@ -336,6 +333,8 @@ impl MasterServer {
} }
} }
} }
} else {
debug!("invalid packet: \"{}\"", Str(src));
} }
Ok(()) Ok(())

Loading…
Cancel
Save