Julius Pfrommer 8 yıl önce
ebeveyn
işleme
ec53b49e26
2 değiştirilmiş dosya ile 11 ekleme ve 6 silme
  1. 4 2
      src/server/ua_session_manager.c
  2. 7 4
      src/ua_securechannel.c

+ 4 - 2
src/server/ua_session_manager.c

@@ -45,14 +45,16 @@ UA_SessionManager_getSession(UA_SessionManager *sm, const UA_NodeId *token) {
         if(UA_NodeId_equal(&current->session.authenticationToken, token)) {
             if(UA_DateTime_now() > current->session.validTill) {
                 UA_LOG_DEBUG(sm->server->config.logger, UA_LOGCATEGORY_SESSION,
-                             "Try to use Session with token %i, but has timed out", token->identifier.numeric);
+                             "Try to use Session with token " PRINTF_GUID_FORMAT ", but has timed out",
+                             PRINTF_GUID_DATA((*token)));
                 return NULL;
             }
             return &current->session;
         }
     }
     UA_LOG_DEBUG(sm->server->config.logger, UA_LOGCATEGORY_SESSION,
-                 "Try to use Session with token %i but is not found", token->identifier.numeric);
+                 "Try to use Session with token " PRINTF_GUID_FORMAT " but is not found",
+                 PRINTF_GUID_DATA((*token)));
     return NULL;
 }
 

+ 7 - 4
src/ua_securechannel.c

@@ -22,17 +22,19 @@ void UA_SecureChannel_init(UA_SecureChannel *channel) {
 }
 
 void UA_SecureChannel_deleteMembersCleanup(UA_SecureChannel *channel) {
+    /* Delete members */
     UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&channel->serverAsymAlgSettings);
     UA_ByteString_deleteMembers(&channel->serverNonce);
     UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&channel->clientAsymAlgSettings);
     UA_ByteString_deleteMembers(&channel->clientNonce);
     UA_ChannelSecurityToken_deleteMembers(&channel->securityToken);
     UA_ChannelSecurityToken_deleteMembers(&channel->nextSecurityToken);
-    UA_Connection *c = channel->connection;
-    if(c)
-        UA_Connection_detachSecureChannel(c);
 
-    /* just remove the pointers and free the linked list (not the sessions) */
+    /* Detach from the channel */
+    if(channel->connection)
+        UA_Connection_detachSecureChannel(channel->connection);
+
+    /* Remove session pointers (not the sessions) */
     struct SessionEntry *se, *temp;
     LIST_FOREACH_SAFE(se, &channel->sessions, pointers, temp) {
         if(se->session)
@@ -41,6 +43,7 @@ void UA_SecureChannel_deleteMembersCleanup(UA_SecureChannel *channel) {
         UA_free(se);
     }
 
+    /* Remove the buffered chunks */
     struct ChunkEntry *ch, *temp_ch;
     LIST_FOREACH_SAFE(ch, &channel->chunks, pointers, temp_ch) {
         UA_ByteString_deleteMembers(&ch->bytes);