Commit 98316320 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

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
https://github.com/golang/go/commit/c7ef348bad102b3427b4242018e92eba17d079ba
parent 4032fc1d
...@@ -207,10 +207,11 @@ retry : ...@@ -207,10 +207,11 @@ retry :
&m_overlapped); &m_overlapped);
DWORD last_error= ret? 0: WSAGetLastError(); DWORD last_error= ret? 0: WSAGetLastError();
if (last_error == WSAECONNRESET) if (last_error == WSAECONNRESET || last_error == ERROR_NETNAME_DELETED)
{ {
if (m_tp_io) if (m_tp_io)
CancelThreadpoolIo(m_tp_io); CancelThreadpoolIo(m_tp_io);
closesocket(m_client_socket);
goto retry; goto retry;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment