mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-28 18:16:13 +00:00
mdns: Update answers counter in mdns_add_answer rather than each caller
This simplifies the code and less error prone. Signed-off-by: Axel Lin <axel.lin@ingics.com>
This commit is contained in:
parent
b7c2553b46
commit
f38705c38c
@ -1008,6 +1008,9 @@ mdns_add_answer(struct mdns_outpacket *reply, struct mdns_domain *domain, u16_t
|
||||
/* Write rd_length after when we know the answer size */
|
||||
field16 = htons(reply->write_offset - answer_offset);
|
||||
res = pbuf_take_at(reply->pbuf, &field16, sizeof(field16), rdlen_offset);
|
||||
if (res == ERR_OK) {
|
||||
reply->answers++;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -1295,14 +1298,12 @@ mdns_send_outpacket(struct mdns_outpacket *outpkt)
|
||||
if (res != ERR_OK) {
|
||||
goto cleanup;
|
||||
}
|
||||
outpkt->answers++;
|
||||
}
|
||||
if (outpkt->host_replies & REPLY_HOST_PTR_V4) {
|
||||
res = mdns_add_hostv4_ptr_answer(outpkt, outpkt->cache_flush, outpkt->netif);
|
||||
if (res != ERR_OK) {
|
||||
goto cleanup;
|
||||
}
|
||||
outpkt->answers++;
|
||||
}
|
||||
#endif
|
||||
#if LWIP_IPV6
|
||||
@ -1314,7 +1315,6 @@ mdns_send_outpacket(struct mdns_outpacket *outpkt)
|
||||
if (res != ERR_OK) {
|
||||
goto cleanup;
|
||||
}
|
||||
outpkt->answers++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1327,7 +1327,6 @@ mdns_send_outpacket(struct mdns_outpacket *outpkt)
|
||||
if (res != ERR_OK) {
|
||||
goto cleanup;
|
||||
}
|
||||
outpkt->answers++;
|
||||
}
|
||||
addrindex++;
|
||||
rev_addrs >>= 1;
|
||||
@ -1347,7 +1346,6 @@ mdns_send_outpacket(struct mdns_outpacket *outpkt)
|
||||
if (res != ERR_OK) {
|
||||
goto cleanup;
|
||||
}
|
||||
outpkt->answers++;
|
||||
}
|
||||
|
||||
if (outpkt->serv_replies[i] & REPLY_SERVICE_NAME_PTR) {
|
||||
@ -1355,7 +1353,6 @@ mdns_send_outpacket(struct mdns_outpacket *outpkt)
|
||||
if (res != ERR_OK) {
|
||||
goto cleanup;
|
||||
}
|
||||
outpkt->answers++;
|
||||
}
|
||||
|
||||
if (outpkt->serv_replies[i] & REPLY_SERVICE_SRV) {
|
||||
@ -1363,7 +1360,6 @@ mdns_send_outpacket(struct mdns_outpacket *outpkt)
|
||||
if (res != ERR_OK) {
|
||||
goto cleanup;
|
||||
}
|
||||
outpkt->answers++;
|
||||
}
|
||||
|
||||
if (outpkt->serv_replies[i] & REPLY_SERVICE_TXT) {
|
||||
@ -1371,7 +1367,6 @@ mdns_send_outpacket(struct mdns_outpacket *outpkt)
|
||||
if (res != ERR_OK) {
|
||||
goto cleanup;
|
||||
}
|
||||
outpkt->answers++;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user