1
0
Fork 0
quarks/app-emulation/wine/files/AcceptEX.patch

53 lines
2.3 KiB
Diff

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index d3a4590..dd818f2 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -1700,7 +1700,7 @@ static NTSTATUS WS2_async_accept( void *arg, IO_STATUS_BLOCK *iosb, NTSTATUS sta
if (status != STATUS_PENDING)
goto finish;
- return STATUS_SUCCESS;
+ return STATUS_ALERTED;
finish:
iosb->u.Status = status;
@@ -1708,8 +1708,6 @@ finish:
if (wsa->user_overlapped->hEvent)
SetEvent(wsa->user_overlapped->hEvent);
- if (wsa->cvalue)
- WS_AddCompletion( HANDLE2SOCKET(wsa->listen_socket), wsa->cvalue, iosb->u.Status, iosb->Information );
*apc = ws2_async_accept_apc;
return status;
@@ -2040,7 +2038,9 @@ static BOOL WINAPI WS2_AcceptEx(SOCKET listener, SOCKET acceptor, PVOID dest, DW
req->async.callback = wine_server_client_ptr( WS2_async_accept );
req->async.iosb = wine_server_client_ptr( overlapped );
req->async.arg = wine_server_client_ptr( wsa );
- /* We don't set event or completion since we may also have to read */
+ req->async.cvalue = cvalue;
+ /* We don't set event since we may also have to read, completion returns STATUS_ALERTED
+ * to indicate that no completion should be queued. */
status = wine_server_call( req );
}
SERVER_END_REQ;
diff --git a/server/async.c b/server/async.c
index dd28dff..b8be5cd 100644
--- a/server/async.c
+++ b/server/async.c
@@ -256,10 +256,12 @@ void async_set_result( struct object *obj, unsigned int status, unsigned int tot
else
{
if (async->timeout) remove_timeout_user( async->timeout );
+ if (async->completion && async->data.cvalue && status != STATUS_ALERTED)
+ add_completion( async->completion, async->comp_key, async->data.cvalue, status, total );
+ else if (async->completion && async->data.cvalue && status == STATUS_ALERTED)
+ status = STATUS_SUCCESS;
async->timeout = NULL;
async->status = status;
- if (async->completion && async->data.cvalue)
- add_completion( async->completion, async->comp_key, async->data.cvalue, status, total );
if (apc)
{
apc_call_t data;