Paul Gofman : winhttp: Fix dwResult field in websocket receive error result.
Alexandre Julliard
julliard at winehq.org
Wed Jun 8 15:56:05 CDT 2022
Module: wine
Branch: master
Commit: 66ff3594c4f6d84b9437a247d411562e65c133c4
URL: https://source.winehq.org/git/wine.git/?a=commit;h=66ff3594c4f6d84b9437a247d411562e65c133c4
Author: Paul Gofman <pgofman at codeweavers.com>
Date: Mon Jun 6 22:01:45 2022 -0500
winhttp: Fix dwResult field in websocket receive error result.
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
dlls/winhttp/request.c | 37 ++++++++++++++++++++-----------------
1 file changed, 20 insertions(+), 17 deletions(-)
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 70d727c7e2e..29887c8d7d0 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -3839,6 +3839,25 @@ static DWORD socket_receive( struct socket *socket, void *buf, DWORD len, DWORD
return ret;
}
+static void socket_receive_complete( struct socket *socket, DWORD ret, WINHTTP_WEB_SOCKET_BUFFER_TYPE type, DWORD len )
+{
+ if (!ret)
+ {
+ WINHTTP_WEB_SOCKET_STATUS status;
+ status.dwBytesTransferred = len;
+ status.eBufferType = type;
+ send_callback( &socket->hdr, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, &status, sizeof(status) );
+ }
+ else
+ {
+ WINHTTP_WEB_SOCKET_ASYNC_RESULT result;
+ result.AsyncResult.dwResult = 0;
+ result.AsyncResult.dwError = ret;
+ result.Operation = WINHTTP_WEB_SOCKET_RECEIVE_OPERATION;
+ send_callback( &socket->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) );
+ }
+}
+
static void task_socket_receive( void *ctx )
{
struct socket_receive *r = ctx;
@@ -3850,23 +3869,7 @@ static void task_socket_receive( void *ctx )
ret = socket_receive( socket, r->buf, r->len, &count, &type );
if (receive_io_complete( socket ))
- {
- if (!ret)
- {
- WINHTTP_WEB_SOCKET_STATUS status;
- status.dwBytesTransferred = count;
- status.eBufferType = type;
- send_callback( &socket->hdr, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, &status, sizeof(status) );
- }
- else
- {
- WINHTTP_WEB_SOCKET_ASYNC_RESULT result;
- result.AsyncResult.dwResult = API_READ_DATA;
- result.AsyncResult.dwError = ret;
- result.Operation = WINHTTP_WEB_SOCKET_RECEIVE_OPERATION;
- send_callback( &socket->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) );
- }
- }
+ socket_receive_complete( socket, ret, type, count );
}
DWORD WINAPI WinHttpWebSocketReceive( HINTERNET hsocket, void *buf, DWORD len, DWORD *ret_len,
More information about the wine-cvs
mailing list