When maximum secure channels reached, new successful sockets connections are never closed
Description
On server side, after the maximum number of secure channels is reached. New socket connections are still successful but the server does not respond anymore after that.
Analysis
When the maximum number of secure channels is reached, new socket connections attempts are accepted until no socket available remaining. The accepted socket connections are asked to be closed by the secure channels layers which has no secure channel slots anymore. But the socket layer ignore the close socket request because the connection index provided is different than the one recorded. This is due to an invalid assignment of the connection index during socket acceptation treatment.
Fix
Do not assign a connection index (endpoint configuration index in this case) to socket during acceptation to allow socket to be closed if no secure channel is available.