增加命令

This commit is contained in:
lubeilin
2023-01-04 22:09:59 +08:00
parent e37b4d718b
commit d4f941d4e7
9 changed files with 119 additions and 51 deletions
+2 -2
View File
@@ -200,12 +200,12 @@ fn other_handle(
}
Protocol::Control => {
match ControlPacket::new(net_packet.transport_protocol(), net_packet.payload())? {
ControlPacket::PingPacket(_) => {
ControlPacket::PingPacket(ping) => {
net_packet.set_transport_protocol(control_packet::Protocol::Pong.into());
udp.send_to(&net_packet.buffer()[..12], peer_addr)?;
}
ControlPacket::PongPacket(pong_packet) => {
let current_time = Local::now().timestamp();
let current_time = Local::now().timestamp_millis();
let rt = current_time - pong_packet.time();
if rt >= 0 {
if peer_addr == server_addr {