Fix compilation using WITH_OLD_KEEPALIVE

Closes #3250. Thanks to Stefan Bigler
This commit is contained in:
Roger A. Light
2025-05-01 13:44:48 +01:00
parent a250ae59ef
commit ca8f00fab5
3 changed files with 7 additions and 8 deletions

View File

@@ -14,6 +14,7 @@ Broker:
Closes #3238.
- Fix reporting of client disconnections being incorrectly attributed to "out
of memory". Closes #3253.
- Fix compilation when using `WITH_OLD_KEEPALIVE`. Closes #3250.
Client library:
- Fix C++ symbols being removed when compiled with link time optimisation.

View File

@@ -113,6 +113,12 @@ if (WITH_PERSISTENCE)
add_definitions("-DWITH_PERSISTENCE")
endif (WITH_PERSISTENCE)
option(WITH_OLD_KEEPALIVE
"Use legacy keepalive check mechanism?" OFF)
if (WITH_OLD_KEEPALIVE)
add_definitions("-DWITH_OLD_KEEPALIVE")
endif (WITH_OLD_KEEPALIVE)
option(WITH_SYS_TREE
"Include $SYS tree support?" ON)
if (WITH_SYS_TREE)

View File

@@ -146,15 +146,7 @@ void keepalive__check(void)
void keepalive__check(void)
{
struct mosquitto *context, *ctxt_tmp;
time_t timeout;
if(db.contexts_by_sock){
timeout = (last_keepalive_check + 5 - db.now_s);
if(timeout <= 0){
timeout = 5;
}
loop__update_next_event(timeout*1000);
}
if(last_keepalive_check + 5 <= db.now_s){
last_keepalive_check = db.now_s;