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
|
||||
|
||||
/** @brief Maximum number of retransmissions for a confirmable request */
|
||||
#ifndef COAP_MAX_RETRANSMIT
|
||||
#define COAP_MAX_RETRANSMIT (4)
|
||||
#ifndef CONFIG_COAP_MAX_RETRANSMIT
|
||||
#define CONFIG_COAP_MAX_RETRANSMIT (4)
|
||||
#endif
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
||||
@ -247,7 +247,7 @@ static void _on_resp_timeout(void *arg) {
|
||||
#ifdef CONFIG_GCOAP_NO_RETRANS_BACKOFF
|
||||
unsigned i = 0;
|
||||
#else
|
||||
unsigned i = COAP_MAX_RETRANSMIT - memo->send_limit;
|
||||
unsigned i = CONFIG_COAP_MAX_RETRANSMIT - memo->send_limit;
|
||||
#endif
|
||||
uint32_t timeout = ((uint32_t)CONFIG_COAP_ACK_TIMEOUT << i) * US_PER_SEC;
|
||||
#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) {
|
||||
memo->send_limit = COAP_MAX_RETRANSMIT;
|
||||
memo->send_limit = CONFIG_COAP_MAX_RETRANSMIT;
|
||||
timeout = (uint32_t)CONFIG_COAP_ACK_TIMEOUT * US_PER_SEC;
|
||||
#if CONFIG_COAP_RANDOM_FACTOR_1000 > 1000
|
||||
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 *
|
||||
* ACK_RANDOM_FACTOR) */
|
||||
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) {
|
||||
|
||||
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);
|
||||
|
||||
/* add 1 for initial transmit */
|
||||
unsigned tries_left = COAP_MAX_RETRANSMIT + 1;
|
||||
unsigned tries_left = CONFIG_COAP_MAX_RETRANSMIT + 1;
|
||||
|
||||
while (tries_left) {
|
||||
if (res == -EAGAIN) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user