Ok, here we go. Feedback in place.
dlls/ws2_32/socket.c | 18 ++++++++---------- server/handle.c | 11 ----------- server/protocol.def | 2 +- server/sock.c | 12 +++++++++++- 4 files changed, 20 insertions(+), 23 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 66d5b2b..a4c442f 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -1473,16 +1473,14 @@ INT WINAPI WSACleanup(void) num_startup--; if (num_startup == 0) { - SERVER_START_REQ(close_all_sockets) - { - wine_server_call( req ); - } - SERVER_END_REQ; - } - else - { - TRACE("pending cleanups: %d\n", num_startup); - } + SERVER_START_REQ(close_process_sockets) + { + wine_server_call( req ); + } + SERVER_END_REQ; + } + + TRACE("pending cleanups: %d\n", num_startup); return 0; } SetLastError(WSANOTINITIALISED); diff --git a/server/handle.c b/server/handle.c index b4b5ecb..53bf50a 100644 --- a/server/handle.c +++ b/server/handle.c @@ -39,8 +39,6 @@ #include "security.h" #include "request.h"
-extern struct object_ops sock_ops; - struct handle_entry { struct object *ptr; /* object */ @@ -610,15 +608,6 @@ DECL_HANDLER(set_handle_info) reply->old_flags = set_handle_flags( current->process, req->handle, req->mask, req->flags ); }
-DECL_HANDLER(close_all_sockets) -{ - obj_handle_t sock; - UINT index = 0; - while ( (sock = enumerate_handles(current->process, &sock_ops, &index)) ) - { - close_handle(current->process, sock); - } -}
/* duplicate a handle */ DECL_HANDLER(dup_handle) diff --git a/server/protocol.def b/server/protocol.def index 651af47..fb63da1 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -943,7 +943,7 @@ struct rawinput_device @END
/* Close all sockets for the current process */ -@REQ(close_all_sockets) +@REQ(close_process_sockets) @END
/* Set a handle information */ diff --git a/server/sock.c b/server/sock.c index 2a9f444..c077755 100644 --- a/server/sock.c +++ b/server/sock.c @@ -138,7 +138,7 @@ static int sock_get_ntstatus( int err ); static int sock_get_error( int err ); static void sock_set_error(void);
-const struct object_ops sock_ops = +static const struct object_ops sock_ops = { sizeof(struct sock), /* size */ sock_dump, /* dump */ @@ -1383,3 +1383,13 @@ DECL_HANDLER(get_socket_info)
release_object( &sock->obj ); } + +DECL_HANDLER(close_process_sockets) +{ + obj_handle_t sock; + unsigned int index = 0; + while ( (sock = enumerate_handles(current->process, &sock_ops, &index)) ) + { + close_handle(current->process, sock); + } +}