1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

gcoap_dns: fix block-wise transfer

This commit is contained in:
Martine Lenders 2022-07-25 19:52:20 +02:00
parent 349a89c9fa
commit 875411fd3a
No known key found for this signature in database
GPG Key ID: 2134D77A5336DD80

View File

@ -695,7 +695,7 @@ static void _resp_handler(const gcoap_request_memo_t *memo, coap_pkt_t *pdu,
memcpy(&dns_buf[block.offset], pdu->payload, pdu->payload_len);
if (block.blknum == 0) {
context->dns_buf_len = pdu->payload_len;
if (block.more && strlen(_uri) > 0) {
if (block.more && strlen(_uri) == 0) {
DEBUG("gcoap_dns: Cannot complete block-wise\n");
context->res = -EINVAL;
goto unlock;
@ -709,6 +709,8 @@ static void _resp_handler(const gcoap_request_memo_t *memo, coap_pkt_t *pdu,
unsigned msg_type = coap_get_type(pdu);
int len;
pdu->payload = (uint8_t *)pdu->hdr;
pdu->payload_len = CONFIG_GCOAP_DNS_PDU_BUF_SIZE;
tl_type = _req_init(pdu, &_uri_comp, msg_type == COAP_TYPE_ACK);
block.blknum++;
if (coap_opt_add_block2_control(pdu, &block) < 0) {