Client: in case of disconnection last response message might not be treated
Description
In case of disconnection from the server, it is possible that the last response message received prior to the disconnection is not treated. It might lead the client wrapper layer to a deadlock in synchronous service call (see issue #1315 (closed)) because the request timeout/failure is not triggered in this case.
Analysis
In SC layer the internal event of ERR or CLO message is added as next event to treat in priority (SC_Chunks_TreatReceivedBuffer
).
When the bytes buffer contains several messages and there is other messages prior to the ERR or CLO message, those messages are then ignored since ERR/CLO is treated in priority and then other messages are ignored due to SC closed state.
Moreover the response message in this case is considered received and NO further request timeout/failure will then be sent.
Implementation
In order to avoid possible issues on messages / connection event reception order, the internal event shall all be added as next event to treat (greatest priority compared to external events from socket layer or services layer). Moreover the reception order in SC_Chunks_TreatReceivedBuffer
shall be preserved when adding those events.