[mio] 减少读更新

This commit is contained in:
lubeilin
2024-03-03 00:35:02 +08:00
parent f0ac70c995
commit 1eb2a0f5cf
3 changed files with 3 additions and 3 deletions
+1
View File
@@ -165,6 +165,7 @@ impl ClientPacketHandler {
) -> io::Result<()> {
let metric = net_packet.source_ttl() - net_packet.ttl() + 1;
let source = net_packet.source();
context.route_table.update_read_time(&source, &route_key);
match ControlPacket::new(net_packet.transport_protocol(), net_packet.payload())? {
ControlPacket::PingPacket(_) => {
net_packet.set_transport_protocol(control_packet::Protocol::Pong.into());
-2
View File
@@ -112,8 +112,6 @@ impl<Call: VntCallback> RecvDataHandler<Call> {
}
let current_device = self.current_device.load();
let dest = net_packet.destination();
let source = net_packet.source();
context.route_table.update_read_time(&source, &route_key);
if dest == current_device.virtual_ip
|| dest.is_broadcast()
|| dest.is_multicast()
+2 -1
View File
@@ -89,11 +89,12 @@ impl<Call: VntCallback> PacketHandler for ServerPacketHandler<Call> {
context: &Context,
current_device: &CurrentDeviceInfo,
) -> io::Result<()> {
context.route_table.update_read_time(&net_packet.source(), &route_key);
if net_packet.protocol() == Protocol::Error
&& net_packet.transport_protocol()
== crate::protocol::error_packet::Protocol::NoKey.into()
{
//开启服务端加密的情况下,只有这个回应是不加密的,是服务端通知客户端上传密钥
//服务端通知客户端上传密钥
#[cfg(feature = "server_encrypt")]
{
let mutex_guard = self.rsa_cipher.lock();