mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
net/emcute : Move 'EMCUTE_KEEPALIVE' to 'CONFIG_'
This commit is contained in:
parent
4bb866c59e
commit
752f76248b
@ -124,7 +124,7 @@ extern "C" {
|
||||
#define CONFIG_EMCUTE_TOPIC_MAXLEN (196U)
|
||||
#endif
|
||||
|
||||
#ifndef EMCUTE_KEEPALIVE
|
||||
#ifndef CONFIG_EMCUTE_KEEPALIVE
|
||||
/**
|
||||
* @brief Keep-alive interval [in s]
|
||||
*
|
||||
@ -133,7 +133,7 @@ extern "C" {
|
||||
*
|
||||
* For the default value, see spec v1.2, section 7.2 -> T_WAIT: > 5 min
|
||||
*/
|
||||
#define EMCUTE_KEEPALIVE (360) /* -> 6 min*/
|
||||
#define CONFIG_EMCUTE_KEEPALIVE (360) /* -> 6 min*/
|
||||
#endif
|
||||
|
||||
#ifndef EMCUTE_T_RETRY
|
||||
|
@ -241,7 +241,7 @@ int emcute_con(sock_udp_ep_t *remote, bool clean, const char *will_topic,
|
||||
tbuf[1] = CONNECT;
|
||||
tbuf[2] = flags;
|
||||
tbuf[3] = PROTOCOL_VERSION;
|
||||
byteorder_htobebufs(&tbuf[4], EMCUTE_KEEPALIVE);
|
||||
byteorder_htobebufs(&tbuf[4], CONFIG_EMCUTE_KEEPALIVE);
|
||||
memcpy(&tbuf[6], cli_id, strlen(cli_id));
|
||||
|
||||
/* configure 'state machine' and send the connection request */
|
||||
@ -509,7 +509,7 @@ void emcute_run(uint16_t port, const char *id)
|
||||
}
|
||||
|
||||
uint32_t start = xtimer_now_usec();
|
||||
uint32_t t_out = (EMCUTE_KEEPALIVE * US_PER_SEC);
|
||||
uint32_t t_out = (CONFIG_EMCUTE_KEEPALIVE * US_PER_SEC);
|
||||
|
||||
while (1) {
|
||||
ssize_t len = sock_udp_recv(&sock, rbuf, sizeof(rbuf), t_out, &remote);
|
||||
@ -556,13 +556,13 @@ void emcute_run(uint16_t port, const char *id)
|
||||
}
|
||||
|
||||
uint32_t now = xtimer_now_usec();
|
||||
if ((now - start) >= (EMCUTE_KEEPALIVE * US_PER_SEC)) {
|
||||
if ((now - start) >= (CONFIG_EMCUTE_KEEPALIVE * US_PER_SEC)) {
|
||||
send_ping();
|
||||
start = now;
|
||||
t_out = (EMCUTE_KEEPALIVE * US_PER_SEC);
|
||||
t_out = (CONFIG_EMCUTE_KEEPALIVE * US_PER_SEC);
|
||||
}
|
||||
else {
|
||||
t_out = (EMCUTE_KEEPALIVE * US_PER_SEC) - (now - start);
|
||||
t_out = (CONFIG_EMCUTE_KEEPALIVE * US_PER_SEC) - (now - start);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user