Skip to content

Commit 517fff0

Browse files
ManMansonzpostfacto
authored andcommitted
Fix incorrect control buffer length when filling WSAMSG for WSARecvMsg
Somehow, this bug causes problems with listen sockets on Windows 11 platform. After some number of client connections being abruptly terminated (e.g. client has crashed), the host just stops to invoke connection state change callbacks for the still opened listen socket. In this particular case, `WSARecvMsg` always returns -1 (SOCKET_ERROR) and `WSAGetLastError()` returns 10014 (WSAEFAULT), which indicates there's a problem with function arguments. So, it seems, that in some cases Windows will try to use the control data, but if there's been some problem with it, the connection will just remain in the broken state forever. Signed-off-by: Pavel Solodovnikov <[email protected]>
1 parent b744f1b commit 517fff0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/steamnetworkingsockets/clientlib/steamnetworkingsockets_lowlevel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2373,7 +2373,7 @@ static bool DrainSocket( CRawUDPSocketImpl *pSock )
23732373
{
23742374
msg.dwBufferCount = 1;
23752375
msg.lpBuffers = (WSABUF *)&iov_buf;
2376-
msg.Control.len = sizeof(buf);
2376+
msg.Control.len = sizeof(buf_control);
23772377
msg.Control.buf = buf_control;
23782378
msg.dwFlags = 0;
23792379

0 commit comments

Comments
 (0)