dns_server: fix max ttl reply issue.

This commit is contained in:
Nick Peng
2023-05-09 23:22:08 +08:00
parent ed102cda03
commit 0340d272c3
9 changed files with 49 additions and 41 deletions

View File

@@ -2239,12 +2239,14 @@ static int _dns_client_process_udp_proxy(struct dns_server_info *server_info, st
}
int latency = get_tick_count() - server_info->send_tick;
tlog(TLOG_DEBUG, "recv udp packet from %s, len: %d, latency: %d",
get_host_by_addr(from_host, sizeof(from_host), (struct sockaddr *)&from), len, latency);
if (latency < server_info->drop_packet_latency_ms) {
tlog(TLOG_DEBUG, "drop packet from %s, latency: %d", from_host, latency);
return 0;
}
tlog(TLOG_DEBUG, "recv udp packet from %s, len: %d",
get_host_by_addr(from_host, sizeof(from_host), (struct sockaddr *)&from), len);
/* update recv time */
time(&server_info->last_recv);
@@ -2322,14 +2324,15 @@ static int _dns_client_process_udp(struct dns_server_info *server_info, struct e
}
}
tlog(TLOG_DEBUG, "recv udp packet from %s, len: %d, ttl: %d",
get_host_by_addr(from_host, sizeof(from_host), (struct sockaddr *)&from), len, ttl);
int latency = get_tick_count() - server_info->send_tick;
tlog(TLOG_DEBUG, "recv udp packet from %s, len: %d, ttl: %d, latency: %d",
get_host_by_addr(from_host, sizeof(from_host), (struct sockaddr *)&from), len, ttl, latency);
/* update recv time */
time(&server_info->last_recv);
int latency = get_tick_count() - server_info->send_tick;
if (latency < server_info->drop_packet_latency_ms) {
tlog(TLOG_DEBUG, "drop packet from %s, latency: %d", from_host, latency);
return 0;
}