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:
commit
c8e87e7854
@ -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]
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user