From 3b69baaee85a99d3091b6fffdad0d8b8a95df6ec Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 28 Jul 2023 15:35:02 -0600 Subject: [PATCH] winhttp: Skip unexpected completions in netconn_wait_overlapped_result(). --- dlls/winhttp/net.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/dlls/winhttp/net.c b/dlls/winhttp/net.c index 3a5847865bf..e46f2023fae 100644 --- a/dlls/winhttp/net.c +++ b/dlls/winhttp/net.c @@ -56,15 +56,16 @@ BOOL netconn_wait_overlapped_result( struct netconn *conn, WSAOVERLAPPED *ovr, D OVERLAPPED *completion_ovr; ULONG_PTR key; - if (!GetQueuedCompletionStatus( conn->port, len, &key, &completion_ovr, INFINITE )) + while (1) { - WARN( "GetQueuedCompletionStatus failed, err %lu.\n", GetLastError() ); - return FALSE; - } - if ((key != conn->socket && conn->socket != -1) || completion_ovr != (OVERLAPPED *)ovr) - { - ERR( "Unexpected completion key %Ix, overlapped %p.\n", key, completion_ovr ); - return FALSE; + if (!GetQueuedCompletionStatus( conn->port, len, &key, &completion_ovr, INFINITE )) + { + WARN( "GetQueuedCompletionStatus failed, err %lu.\n", GetLastError() ); + return FALSE; + } + if (completion_ovr == (OVERLAPPED *)ovr && (key == conn->socket || conn->socket == -1)) + break; + ERR( "Unexpected completion key %Ix, completion ovr %p, ovr %p.\n", key, completion_ovr, ovr ); } return TRUE; }