Session service: connecting client/server on itself fails on ActivateSession with OpcUa_BadInvalidState
Description
In session service: an application implementing client and server in same binary with client connecting on self-server fails on ActivateSession with OpcUa_BadInvalidState
Analysis
The session states are shared by client and server sessions services of toolkit which lead to incoherent state and transitions in the model and the implementation of session services.
The exact issue is the get_session_from_token
function which might find 2 valid session indexes for same token since client and server have a different index for the same token. It leads the server to retrieve the session id of the client instead of the session id it created for this same session.
Fix
Store session states in different data structures for client and server in C implemented code.
Edited by Vincent Monfort