diff --git a/sys/include/net/coap.h b/sys/include/net/coap.h index f2322f49aa..b25033eed3 100644 --- a/sys/include/net/coap.h +++ b/sys/include/net/coap.h @@ -181,7 +181,7 @@ extern "C" { * timeout doubles for subsequent retries. To avoid synchronization of resends * across hosts, the actual timeout is chosen randomly between * @ref CONFIG_COAP_ACK_TIMEOUT and - * (@ref CONFIG_COAP_ACK_TIMEOUT * @ref COAP_RANDOM_FACTOR_1000 / 1000). + * (@ref CONFIG_COAP_ACK_TIMEOUT * @ref CONFIG_COAP_RANDOM_FACTOR_1000 / 1000). */ #ifndef CONFIG_COAP_ACK_TIMEOUT #define CONFIG_COAP_ACK_TIMEOUT (2U) @@ -196,8 +196,8 @@ extern "C" { * * See @ref CONFIG_COAP_ACK_TIMEOUT */ -#ifndef COAP_RANDOM_FACTOR_1000 -#define COAP_RANDOM_FACTOR_1000 (1500) +#ifndef CONFIG_COAP_RANDOM_FACTOR_1000 +#define CONFIG_COAP_RANDOM_FACTOR_1000 (1500) #endif /** @brief Maximum number of retransmissions for a confirmable request */ diff --git a/sys/net/application_layer/gcoap/gcoap.c b/sys/net/application_layer/gcoap/gcoap.c index 13137afe71..bc8bbcae24 100644 --- a/sys/net/application_layer/gcoap/gcoap.c +++ b/sys/net/application_layer/gcoap/gcoap.c @@ -42,7 +42,7 @@ #define GCOAP_RESOURCE_NO_PATH -2 /* End of the range to pick a random timeout */ -#define TIMEOUT_RANGE_END (CONFIG_COAP_ACK_TIMEOUT * COAP_RANDOM_FACTOR_1000 / 1000) +#define TIMEOUT_RANGE_END (CONFIG_COAP_ACK_TIMEOUT * CONFIG_COAP_RANDOM_FACTOR_1000 / 1000) /* Internal functions */ static void *_event_loop(void *arg); @@ -250,7 +250,7 @@ static void _on_resp_timeout(void *arg) { unsigned i = COAP_MAX_RETRANSMIT - memo->send_limit; #endif uint32_t timeout = ((uint32_t)CONFIG_COAP_ACK_TIMEOUT << i) * US_PER_SEC; -#if COAP_RANDOM_FACTOR_1000 > 1000 +#if CONFIG_COAP_RANDOM_FACTOR_1000 > 1000 uint32_t end = ((uint32_t)TIMEOUT_RANGE_END << i) * US_PER_SEC; timeout = random_uint32_range(timeout, end); #endif @@ -774,7 +774,7 @@ size_t gcoap_req_send(const uint8_t *buf, size_t len, if (memo->msg.data.pdu_buf) { memo->send_limit = COAP_MAX_RETRANSMIT; timeout = (uint32_t)CONFIG_COAP_ACK_TIMEOUT * US_PER_SEC; -#if COAP_RANDOM_FACTOR_1000 > 1000 +#if CONFIG_COAP_RANDOM_FACTOR_1000 > 1000 timeout = random_uint32_range(timeout, TIMEOUT_RANGE_END * US_PER_SEC); #endif }