mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-16 10:03:50 +01:00
net/asymcute : Move 'ASYMCUTE_N_RETRY' to 'CONFIG_'
This commit is contained in:
parent
6dc5747c4b
commit
a1df2e33b0
@ -145,13 +145,13 @@ extern "C" {
|
|||||||
#define CONFIG_ASYMCUTE_T_RETRY (10U) /* -> 10 sec */
|
#define CONFIG_ASYMCUTE_T_RETRY (10U) /* -> 10 sec */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ASYMCUTE_N_RETRY
|
#ifndef CONFIG_ASYMCUTE_N_RETRY
|
||||||
/**
|
/**
|
||||||
* @brief Number of retransmissions until requests time out
|
* @brief Number of retransmissions until requests time out
|
||||||
*
|
*
|
||||||
* For the default value, see spec v1.2, section 7.2 -> N_RETRY: 3-5
|
* 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
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -181,7 +181,7 @@ static void _req_send(asymcute_req_t *req, asymcute_con_t *con,
|
|||||||
/* initialize request */
|
/* initialize request */
|
||||||
req->con = con;
|
req->con = con;
|
||||||
req->cb = cb;
|
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_callback_init(&req->to_evt, _on_req_timeout, (void *)req);
|
||||||
event_timeout_init(&req->to_timer, &_queue, &req->to_evt.super);
|
event_timeout_init(&req->to_timer, &_queue, &req->to_evt.super);
|
||||||
/* add request to the pending queue (if non-con request) */
|
/* 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) {
|
if (data[2] == MQTTSN_ACCEPTED) {
|
||||||
con->state = CONNECTED;
|
con->state = CONNECTED;
|
||||||
/* start keep alive timer */
|
/* 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);
|
event_timeout_set(&con->keepalive_timer, KEEPALIVE_TO);
|
||||||
ret = ASYMCUTE_CONNECTED;
|
ret = ASYMCUTE_CONNECTED;
|
||||||
}
|
}
|
||||||
@ -369,9 +369,9 @@ static void _on_pingresp(asymcute_con_t *con)
|
|||||||
{
|
{
|
||||||
mutex_lock(&con->lock);
|
mutex_lock(&con->lock);
|
||||||
/* only handle ping resp message if we are actually waiting for a reply */
|
/* 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);
|
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);
|
event_timeout_set(&con->keepalive_timer, KEEPALIVE_TO);
|
||||||
}
|
}
|
||||||
mutex_unlock(&con->lock);
|
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);
|
random_bytes((uint8_t *)&con->last_id, 2);
|
||||||
event_callback_init(&con->keepalive_evt, _on_keepalive_evt, con);
|
event_callback_init(&con->keepalive_evt, _on_keepalive_evt, con);
|
||||||
event_timeout_init(&con->keepalive_timer, &_queue, &con->keepalive_evt.super);
|
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->state = NOTCON;
|
||||||
con->user_cb = callback;
|
con->user_cb = callback;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user