|
@@ -4,12 +4,14 @@
|
|
|
|
|
|
UA_StatusCode
|
|
|
UA_SessionManager_init(UA_SessionManager *sessionManager, UA_UInt32 maxSessionCount,
|
|
|
- UA_UInt32 maxSessionLifeTime, UA_UInt32 startSessionId) {
|
|
|
+ UA_UInt32 maxSessionLifeTime, UA_UInt32 startSessionId,
|
|
|
+ UA_Logger logger) {
|
|
|
LIST_INIT(&sessionManager->sessions);
|
|
|
sessionManager->maxSessionCount = maxSessionCount;
|
|
|
sessionManager->lastSessionId = startSessionId;
|
|
|
sessionManager->maxSessionLifeTime = maxSessionLifeTime;
|
|
|
sessionManager->currentSessionCount = 0;
|
|
|
+ sessionManager->logger = logger;
|
|
|
return UA_STATUSCODE_GOOD;
|
|
|
}
|
|
|
|
|
@@ -27,6 +29,8 @@ void UA_SessionManager_cleanupTimedOut(UA_SessionManager *sessionManager,
|
|
|
session_list_entry *sentry, *temp;
|
|
|
LIST_FOREACH_SAFE(sentry, &sessionManager->sessions, pointers, temp) {
|
|
|
if(sentry->session.validTill < now) {
|
|
|
+ UA_LOG_DEBUG(sessionManager->logger, UA_LOGCATEGORY_SESSION, "Session with token %i has timed out and is removed",
|
|
|
+ sentry->session.sessionId.identifier.numeric);
|
|
|
LIST_REMOVE(sentry, pointers);
|
|
|
UA_Session_deleteMembersCleanup(&sentry->session, server);
|
|
|
UA_free(sentry);
|
|
@@ -40,11 +44,16 @@ UA_SessionManager_getSession(UA_SessionManager *sessionManager, const UA_NodeId
|
|
|
session_list_entry *current = NULL;
|
|
|
LIST_FOREACH(current, &sessionManager->sessions, pointers) {
|
|
|
if(UA_NodeId_equal(¤t->session.authenticationToken, token)) {
|
|
|
- if(UA_DateTime_now() > current->session.validTill)
|
|
|
+ if(UA_DateTime_now() > current->session.validTill) {
|
|
|
+ UA_LOG_DEBUG(sessionManager->logger, UA_LOGCATEGORY_SESSION, "Try to use Session with token %i, but has timed out",
|
|
|
+ token->identifier.numeric);
|
|
|
return NULL;
|
|
|
+ }
|
|
|
return ¤t->session;
|
|
|
}
|
|
|
}
|
|
|
+ UA_LOG_DEBUG(sessionManager->logger, UA_LOGCATEGORY_SESSION, "Try to use Session with token %i but is not found",
|
|
|
+ token->identifier.numeric);
|
|
|
return NULL;
|
|
|
}
|
|
|
|