1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

net/asymcute : Move 'ASYMCUTE_N_RETRY' to 'CONFIG_'

This commit is contained in:
Akshai M 2020-06-26 18:00:48 +05:30
parent 6dc5747c4b
commit a1df2e33b0
2 changed files with 7 additions and 7 deletions

View File

@ -145,13 +145,13 @@ extern "C" {
#define CONFIG_ASYMCUTE_T_RETRY (10U) /* -> 10 sec */
#endif
#ifndef ASYMCUTE_N_RETRY
#ifndef CONFIG_ASYMCUTE_N_RETRY
/**
* @brief Number of retransmissions until requests time out
*
* For the default value, see spec v1.2, section 7.2 -> N_RETRY: 3-5
*/
#define ASYMCUTE_N_RETRY (3U)
#define CONFIG_ASYMCUTE_N_RETRY (3U)
#endif
/**

View File

@ -181,7 +181,7 @@ static void _req_send(asymcute_req_t *req, asymcute_con_t *con,
/* initialize request */
req->con = con;
req->cb = cb;
req->retry_cnt = ASYMCUTE_N_RETRY;
req->retry_cnt = CONFIG_ASYMCUTE_N_RETRY;
event_callback_init(&req->to_evt, _on_req_timeout, (void *)req);
event_timeout_init(&req->to_timer, &_queue, &req->to_evt.super);
/* add request to the pending queue (if non-con request) */
@ -328,7 +328,7 @@ static void _on_connack(asymcute_con_t *con, const uint8_t *data, size_t len)
if (data[2] == MQTTSN_ACCEPTED) {
con->state = CONNECTED;
/* start keep alive timer */
con->keepalive_retry_cnt = ASYMCUTE_N_RETRY;
con->keepalive_retry_cnt = CONFIG_ASYMCUTE_N_RETRY;
event_timeout_set(&con->keepalive_timer, KEEPALIVE_TO);
ret = ASYMCUTE_CONNECTED;
}
@ -369,9 +369,9 @@ static void _on_pingresp(asymcute_con_t *con)
{
mutex_lock(&con->lock);
/* only handle ping resp message if we are actually waiting for a reply */
if (con->keepalive_retry_cnt < ASYMCUTE_N_RETRY) {
if (con->keepalive_retry_cnt < CONFIG_ASYMCUTE_N_RETRY) {
event_timeout_clear(&con->keepalive_timer);
con->keepalive_retry_cnt = ASYMCUTE_N_RETRY;
con->keepalive_retry_cnt = CONFIG_ASYMCUTE_N_RETRY;
event_timeout_set(&con->keepalive_timer, KEEPALIVE_TO);
}
mutex_unlock(&con->lock);
@ -637,7 +637,7 @@ int asymcute_listener_run(asymcute_con_t *con, char *stack, size_t stacksize,
random_bytes((uint8_t *)&con->last_id, 2);
event_callback_init(&con->keepalive_evt, _on_keepalive_evt, con);
event_timeout_init(&con->keepalive_timer, &_queue, &con->keepalive_evt.super);
con->keepalive_retry_cnt = ASYMCUTE_N_RETRY;
con->keepalive_retry_cnt = CONFIG_ASYMCUTE_N_RETRY;
con->state = NOTCON;
con->user_cb = callback;