Commit 470b9d03 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ws2_32: Close all open sockets in WSACleanup().

parent 23dbfaad
......@@ -1770,9 +1770,17 @@ int WINAPI WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData)
*/
INT WINAPI WSACleanup(void)
{
if (num_startup) {
num_startup--;
TRACE("pending cleanups: %d\n", num_startup);
TRACE("decreasing startup count from %d\n", num_startup);
if (num_startup)
{
if (!--num_startup)
{
unsigned int i;
for (i = 0; i < socket_list_size; ++i)
CloseHandle(SOCKET2HANDLE(socket_list[i]));
memset(socket_list, 0, socket_list_size * sizeof(*socket_list));
}
return 0;
}
SetLastError(WSANOTINITIALISED);
......
......@@ -1221,7 +1221,6 @@ static void test_WithWSAStartup(void)
ok(res == 0, "WSAStartup() failed unexpectedly: %d\n", res);
/* show that sockets are destroyed automatically after WSACleanup */
todo_wine {
SetLastError(0xdeadbeef);
res = send(pairs[0].src, "TEST", 4, 0);
error = WSAGetLastError();
......@@ -1258,8 +1257,6 @@ static void test_WithWSAStartup(void)
}
}
}
/* While wine is not fixed, close all sockets manually */
for (i = 0; i < socks; i++)
{
......
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