Fix message handler for client example

Fix 2 bugs in message handler:
- problem with sending confirmable next block requests
- problem with deleting pdu after sending
This commit is contained in:
Maciej Wasilak committed 2014-06-17 18:33:05 +02:00
1 parent a3fae3ce3a
commit 3d66bbb8e3
1 file changed
+2 -2
+2 -2
View File
@@ -398,7 +398,7 @@ message_handler(struct coap_context_t *ctx,
((coap_opt_block_num(block_opt) + 1) << 4) |
COAP_OPT_BLOCK_SZX(block_opt)), buf);
if (received->hdr->type == COAP_MESSAGE_CON)
if (pdu->hdr->type == COAP_MESSAGE_CON)
tid = coap_send_confirmed(ctx, remote, pdu);
else
tid = coap_send(ctx, remote, pdu);
@@ -408,7 +408,7 @@ message_handler(struct coap_context_t *ctx,
coap_delete_pdu(pdu);
} else {
set_timeout(&max_wait, wait_seconds);
if (received->hdr->type != COAP_MESSAGE_CON)
if (pdu->hdr->type != COAP_MESSAGE_CON)
coap_delete_pdu(pdu);
}