Skip to content

Commit

Permalink
fix(server): Immediately set new SecureChannels to CONNECTED
Browse files Browse the repository at this point in the history
Now they are correctly purged when too many connections are open.
This fixes the problem reported in open62541#6863.
  • Loading branch information
jpfr committed Nov 20, 2024
1 parent 155dfb0 commit 974c472
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/server/ua_server_binary.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 974c472

Please sign in to comment.