winhttp: Set socket close state in WinHttpWebSocketClose().

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2022-01-25 03:08:04 +03:00 committed by Alexandre Julliard
parent 57b26a83ba
commit 0417d9d015
2 changed files with 7 additions and 7 deletions

View File

@ -3784,7 +3784,6 @@ static DWORD socket_close( struct socket *socket )
if ((ret = socket_drain( socket ))) return ret;
}
socket->state = SOCKET_STATE_CLOSED;
return receive_close_status( socket, count );
}
@ -3834,6 +3833,7 @@ DWORD WINAPI WinHttpWebSocketClose( HINTERNET hsocket, USHORT status, void *reas
if (socket->state < SOCKET_STATE_SHUTDOWN
&& (ret = send_socket_shutdown( socket, status, reason, len, FALSE ))) goto done;
socket->state = SOCKET_STATE_CLOSED;
if (socket->request->connect->hdr.flags & WINHTTP_FLAG_ASYNC)
{
struct socket_shutdown *s;

View File

@ -955,18 +955,18 @@ static void test_websocket(BOOL secure)
close_status = 0xdead;
size = sizeof(buffer) + 1;
err = pWinHttpWebSocketQueryCloseStatus( socket, &close_status, buffer, sizeof(buffer), &size );
ok( err == ERROR_INVALID_OPERATION, "got %u\n", err );
ok( close_status == 0xdead, "got %u\n", close_status );
ok( size == sizeof(buffer) + 1, "got %u\n", size );
todo_wine ok( err == ERROR_INVALID_OPERATION, "got %u\n", err );
todo_wine ok( close_status == 0xdead, "got %u\n", close_status );
todo_wine ok( size == sizeof(buffer) + 1, "got %u\n", size );
WaitForSingleObject( info.wait, INFINITE );
close_status = 0xdead;
size = sizeof(buffer) + 1;
err = pWinHttpWebSocketQueryCloseStatus( socket, &close_status, buffer, sizeof(buffer), &size );
todo_wine ok( err == ERROR_SUCCESS, "got %u\n", err );
todo_wine ok( close_status == 1000, "got %u\n", close_status );
todo_wine ok( size <= sizeof(buffer), "got %u\n", size );
ok( err == ERROR_SUCCESS, "got %u\n", err );
ok( close_status == 1000, "got %u\n", close_status );
ok( size <= sizeof(buffer), "got %u\n", size );
setup_test( &info, winhttp_close_handle, __LINE__ );