diff --git a/sys/include/net/emcute.h b/sys/include/net/emcute.h index 682ddf191d..f4ee91957d 100644 --- a/sys/include/net/emcute.h +++ b/sys/include/net/emcute.h @@ -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 diff --git a/sys/net/application_layer/emcute/emcute.c b/sys/net/application_layer/emcute/emcute.c index ed50885f97..1d5906b591 100644 --- a/sys/net/application_layer/emcute/emcute.c +++ b/sys/net/application_layer/emcute/emcute.c @@ -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); } } }