Merge pull request #630 from samkumar/bugfix-coap-retransmission

Fix bug in CoAP retransmission policy
This commit is contained in:
Niclas Finne 2018-08-30 15:16:56 +02:00 committed by GitHub
commit b49477441c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -98,12 +98,11 @@ coap_send_transaction(coap_transaction_t *t)
{
LOG_DBG("Sending transaction %u\n", t->mid);
coap_sendto(&t->endpoint, t->message, t->message_len);
if(COAP_TYPE_CON ==
((COAP_HEADER_TYPE_MASK & t->message[0]) >> COAP_HEADER_TYPE_POSITION)) {
if(t->retrans_counter < COAP_MAX_RETRANSMIT) {
if(t->retrans_counter <= COAP_MAX_RETRANSMIT) {
/* not timed out yet */
coap_sendto(&t->endpoint, t->message, t->message_len);
LOG_DBG("Keeping transaction %u\n", t->mid);
if(t->retrans_counter == 0) {
@ -138,6 +137,7 @@ coap_send_transaction(coap_transaction_t *t)
}
}
} else {
coap_sendto(&t->endpoint, t->message, t->message_len);
coap_clear_transaction(t);
}
}