Skip to content

Commit

Permalink
fix(pubsub): Always update the timed callback in UA_PubSubKeyStorage_…
Browse files Browse the repository at this point in the history
…addKeyRolloverCallback
  • Loading branch information
jpfr committed Dec 22, 2024
1 parent e391342 commit efecf53
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/pubsub/ua_pubsub_keystorage.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,14 @@ UA_PubSubKeyStorage_addKeyRolloverCallback(UA_Server *server,
if(!server || !keyStorage || !callback || timeToNextMs <= 0)
return UA_STATUSCODE_BADINVALIDARGUMENT;

// Check if the callback already exist
if(*callbackID != 0) {
return UA_STATUSCODE_GOOD;
}

UA_LOCK_ASSERT(&server->serviceMutex, 1);

UA_EventLoop *el = server->config.eventLoop;
if(*callbackID != 0)
el->removeCyclicCallback(el, *callbackID);

UA_DateTime dateTimeToNextKey = UA_DateTime_nowMonotonic() +
(UA_DateTime)(UA_DATETIME_MSEC * timeToNextMs);
UA_EventLoop *el = server->config.eventLoop;
return el->addTimedCallback(el, (UA_Callback)callback, server, keyStorage,
dateTimeToNextKey, callbackID);
}
Expand Down

0 comments on commit efecf53

Please sign in to comment.