Client/Server: connecting sockets are not closed on SC connection timeout
Description
In the particular case of connection attempt to an accessible host which do not answer to connection, the O.S. will only indicate the socket connection failure after several retries and a long timeout (e.g. 2 minutes). During this time the SC layer connection timeout is triggered but do not close the socket because it is not associated yet. It might lead to unavailable socket for new SC connection due to the O.S. timeout.
Details and fix
On SOCKET_CREATE_CONNECTION
event trigger by SC layer (client connection or reverse server connection) the socket layer create a socket and make an attempt for non blocking connect.
In some degraded cases (unresponsive IP) the O.S. will wait for a connection timeout (e.g.: 2 minutes) that is greatest than the SC connection timeout (e.g.: 10 seconds).
In this latter case, the SC is closed in SC layer but the socket cannot be closed because SC layer does not have the socket index information.
For this reason, the SOCKET_CREATED event is added to be triggered on socket creation and prior to the non blocking connect attempt. The socket index shall then be associated to the SC connection and will be closed in case the SC connection timeout occurs prior to SOCKET_FAILURE/SOCKET_CONNECTION event is triggered by socket layer.