From 974c47251a8234a982c776fe09bab653344f5290 Mon Sep 17 00:00:00 2001 From: Julius Pfrommer Date: Wed, 20 Nov 2024 09:42:47 +0100 Subject: [PATCH] fix(server): Immediately set new SecureChannels to CONNECTED Now they are correctly purged when too many connections are open. This fixes the problem reported in #6863. --- src/server/ua_server_binary.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/server/ua_server_binary.c b/src/server/ua_server_binary.c index e6483d8c441..06cb34df3cc 100644 --- a/src/server/ua_server_binary.c +++ b/src/server/ua_server_binary.c @@ -1260,17 +1260,15 @@ serverNetworkCallback(UA_ConnectionManager *cm, uintptr_t connectionId, return; } - UA_LOG_INFO_CHANNEL(bpm->logging, channel, "SecureChannel created"); - /* Set the new channel as the new context for the connection */ *connectionContext = (void*)channel; - return; - } - /* The connection has fully opened */ - if(channel->state < UA_SECURECHANNELSTATE_CONNECTED) + /* Set the channel state to CONNECTED until the HEL message is received */ channel->state = UA_SECURECHANNELSTATE_CONNECTED; + UA_LOG_INFO_CHANNEL(bpm->logging, channel, "SecureChannel created"); + } + /* Received a message on a normal connection */ #ifdef UA_DEBUG_DUMP_PKGS UA_dump_hex_pkg(message->data, message->length);