Skip to content

Commit 9831632

Browse files
committed
MDEV-21444 : Fix socket leak if AcceptEx() return WSAECONNRESET.
Also, ignore/retry on ERROR_NETNAME_DELETED in addition to WSAECONNRESET. This is how golang handles failing AcceptEx(), see golang/go@c7ef348
1 parent 4032fc1 commit 9831632

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sql/handle_connections_win.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,11 @@ retry :
207207
&m_overlapped);
208208

209209
DWORD last_error= ret? 0: WSAGetLastError();
210-
if (last_error == WSAECONNRESET)
210+
if (last_error == WSAECONNRESET || last_error == ERROR_NETNAME_DELETED)
211211
{
212212
if (m_tp_io)
213213
CancelThreadpoolIo(m_tp_io);
214+
closesocket(m_client_socket);
214215
goto retry;
215216
}
216217

0 commit comments

Comments
 (0)