Commit 66ff3594 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

winhttp: Fix dwResult field in websocket receive error result.

parent 3d199dd9
......@@ -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,
......
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