Skip to content

Commit bb4c002

Browse files
authored
Replace hardcoded TTL values with named defines
- Replaces hardcoded PTR "half-TTL" with `MDNS_ANSWER_PTR_TTL/2` (defined in mdns_private.h) - Replaces hardcoded TXT "half-TTL" with `MDNS_ANSWER_TXT_TTL/2` (defined in mdns_private.h)
1 parent 8f00fc1 commit bb4c002

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

components/mdns/mdns.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3520,7 +3520,7 @@ void mdns_parse_packet(mdns_rx_packet_t * packet)
35203520
_mdns_remove_parsed_question(parsed_packet, type, service);
35213521
} else if (service) {
35223522
//check if TTL is more than half of the full TTL value (4500)
3523-
if (ttl > 2250) {
3523+
if (ttl > (MDNS_ANSWER_PTR_TTL/2)) {
35243524
_mdns_remove_scheduled_answer(packet->tcpip_if, packet->ip_protocol, type, service);
35253525
}
35263526
}
@@ -3675,7 +3675,7 @@ void mdns_parse_packet(mdns_rx_packet_t * packet)
36753675
if (col && !_mdns_server->interfaces[packet->tcpip_if].pcbs[packet->ip_protocol].probe_running && service) {
36763676
do_not_reply = true;
36773677
_mdns_init_pcb_probe(packet->tcpip_if, packet->ip_protocol, &service, 1, true);
3678-
} else if (ttl > 2250 && !col && !parsed_packet->authoritative && !parsed_packet->probe && !parsed_packet->questions && !_mdns_server->interfaces[packet->tcpip_if].pcbs[packet->ip_protocol].probe_running) {
3678+
} else if (ttl > (MDNS_ANSWER_TXT_TTL/2) && !col && !parsed_packet->authoritative && !parsed_packet->probe && !parsed_packet->questions && !_mdns_server->interfaces[packet->tcpip_if].pcbs[packet->ip_protocol].probe_running) {
36793679
_mdns_remove_scheduled_answer(packet->tcpip_if, packet->ip_protocol, type, service);
36803680
}
36813681
}

0 commit comments

Comments
 (0)