net/coap: Move COAP_MAX_RETRANSMIT to 'CONFIG' namespace
COAP_MAX_RETRANSMIT is moved to the compile time configuration macro namespace.
This commit is contained in:
parent
afe4244ac9
commit
9e427e1584
@ -201,8 +201,8 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** @brief Maximum number of retransmissions for a confirmable request */
|
/** @brief Maximum number of retransmissions for a confirmable request */
|
||||||
#ifndef COAP_MAX_RETRANSMIT
|
#ifndef CONFIG_COAP_MAX_RETRANSMIT
|
||||||
#define COAP_MAX_RETRANSMIT (4)
|
#define CONFIG_COAP_MAX_RETRANSMIT (4)
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|||||||
@ -247,7 +247,7 @@ static void _on_resp_timeout(void *arg) {
|
|||||||
#ifdef CONFIG_GCOAP_NO_RETRANS_BACKOFF
|
#ifdef CONFIG_GCOAP_NO_RETRANS_BACKOFF
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
#else
|
#else
|
||||||
unsigned i = COAP_MAX_RETRANSMIT - memo->send_limit;
|
unsigned i = CONFIG_COAP_MAX_RETRANSMIT - memo->send_limit;
|
||||||
#endif
|
#endif
|
||||||
uint32_t timeout = ((uint32_t)CONFIG_COAP_ACK_TIMEOUT << i) * US_PER_SEC;
|
uint32_t timeout = ((uint32_t)CONFIG_COAP_ACK_TIMEOUT << i) * US_PER_SEC;
|
||||||
#if CONFIG_COAP_RANDOM_FACTOR_1000 > 1000
|
#if CONFIG_COAP_RANDOM_FACTOR_1000 > 1000
|
||||||
@ -772,7 +772,7 @@ size_t gcoap_req_send(const uint8_t *buf, size_t len,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (memo->msg.data.pdu_buf) {
|
if (memo->msg.data.pdu_buf) {
|
||||||
memo->send_limit = COAP_MAX_RETRANSMIT;
|
memo->send_limit = CONFIG_COAP_MAX_RETRANSMIT;
|
||||||
timeout = (uint32_t)CONFIG_COAP_ACK_TIMEOUT * US_PER_SEC;
|
timeout = (uint32_t)CONFIG_COAP_ACK_TIMEOUT * US_PER_SEC;
|
||||||
#if CONFIG_COAP_RANDOM_FACTOR_1000 > 1000
|
#if CONFIG_COAP_RANDOM_FACTOR_1000 > 1000
|
||||||
timeout = random_uint32_range(timeout, TIMEOUT_RANGE_END * US_PER_SEC);
|
timeout = random_uint32_range(timeout, TIMEOUT_RANGE_END * US_PER_SEC);
|
||||||
|
|||||||
@ -49,7 +49,7 @@ ssize_t nanocoap_request(coap_pkt_t *pkt, sock_udp_ep_t *local, sock_udp_ep_t *r
|
|||||||
/* TODO: timeout random between between ACK_TIMEOUT and (ACK_TIMEOUT *
|
/* TODO: timeout random between between ACK_TIMEOUT and (ACK_TIMEOUT *
|
||||||
* ACK_RANDOM_FACTOR) */
|
* ACK_RANDOM_FACTOR) */
|
||||||
uint32_t timeout = CONFIG_COAP_ACK_TIMEOUT * US_PER_SEC;
|
uint32_t timeout = CONFIG_COAP_ACK_TIMEOUT * US_PER_SEC;
|
||||||
unsigned tries_left = COAP_MAX_RETRANSMIT + 1; /* add 1 for initial transmit */
|
unsigned tries_left = CONFIG_COAP_MAX_RETRANSMIT + 1; /* add 1 for initial transmit */
|
||||||
while (tries_left) {
|
while (tries_left) {
|
||||||
|
|
||||||
res = sock_udp_send(&sock, buf, pdu_len, NULL);
|
res = sock_udp_send(&sock, buf, pdu_len, NULL);
|
||||||
|
|||||||
@ -140,7 +140,7 @@ static ssize_t _nanocoap_request(sock_udp_t *sock, coap_pkt_t *pkt, size_t len)
|
|||||||
uint32_t deadline = deadline_from_interval(timeout);
|
uint32_t deadline = deadline_from_interval(timeout);
|
||||||
|
|
||||||
/* add 1 for initial transmit */
|
/* add 1 for initial transmit */
|
||||||
unsigned tries_left = COAP_MAX_RETRANSMIT + 1;
|
unsigned tries_left = CONFIG_COAP_MAX_RETRANSMIT + 1;
|
||||||
|
|
||||||
while (tries_left) {
|
while (tries_left) {
|
||||||
if (res == -EAGAIN) {
|
if (res == -EAGAIN) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user