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

Merge pull request #11787 from miri64/gcoap/enh/backoff-config

gcoap: allow for retransmission backoff to be turned off
This commit is contained in:
Ken Bannister 2019-08-02 06:40:07 -04:00 committed by GitHub
commit c8e87e7854
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -352,6 +352,20 @@ extern "C" {
#define GCOAP_RECV_TIMEOUT (1 * US_PER_SEC)
#endif
#ifdef DOXYGEN
/**
* @ingroup net_gcoap_conf
* @brief Turns off retransmission backoff when defined (undefined per default)
*
* In normal operations the timeout between retransmissions doubles. When
* GCOAP_NO_RETRANS_BACKOFF is defined this doubling does not happen.
*
* @see COAP_ACK_TIMEOUT
* @see COAP_ACK_VARIANCE
*/
#define GCOAP_NO_RETRANS_BACKOFF
#endif
/**
* @ingroup net_gcoap_conf
* @brief Default time to wait for a non-confirmable response [in usec]

View File

@ -133,7 +133,11 @@ static void *_event_loop(void *arg)
/* reduce retries remaining, double timeout and resend */
else {
memo->send_limit--;
#ifdef GCOAP_NO_RETRANS_BACKOFF
unsigned i = 0;
#else
unsigned i = COAP_MAX_RETRANSMIT - memo->send_limit;
#endif
uint32_t timeout = ((uint32_t)COAP_ACK_TIMEOUT << i) * US_PER_SEC;
#if COAP_ACK_VARIANCE > 0
uint32_t variance = ((uint32_t)COAP_ACK_VARIANCE << i) * US_PER_SEC;