Commit 5ea5db90 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

winhttp: Set socket state to shutdown right away in WinHttpWebSocketShutdown().

parent 01c02f60
...@@ -3652,14 +3652,7 @@ DWORD WINAPI WinHttpWebSocketReceive( HINTERNET hsocket, void *buf, DWORD len, D ...@@ -3652,14 +3652,7 @@ DWORD WINAPI WinHttpWebSocketReceive( HINTERNET hsocket, void *buf, DWORD len, D
static DWORD socket_shutdown( struct socket *socket, USHORT status, const void *reason, DWORD len ) static DWORD socket_shutdown( struct socket *socket, USHORT status, const void *reason, DWORD len )
{ {
DWORD ret; return send_frame( socket, SOCKET_OPCODE_CLOSE, status, reason, len, TRUE, NULL );
stop_queue( &socket->send_q );
if (!(ret = send_frame( socket, SOCKET_OPCODE_CLOSE, status, reason, len, TRUE, NULL )))
{
socket->state = SOCKET_STATE_SHUTDOWN;
}
return ret;
} }
static void CALLBACK task_socket_shutdown( TP_CALLBACK_INSTANCE *instance, void *ctx, TP_WORK *work ) static void CALLBACK task_socket_shutdown( TP_CALLBACK_INSTANCE *instance, void *ctx, TP_WORK *work )
...@@ -3707,6 +3700,8 @@ DWORD WINAPI WinHttpWebSocketShutdown( HINTERNET hsocket, USHORT status, void *r ...@@ -3707,6 +3700,8 @@ DWORD WINAPI WinHttpWebSocketShutdown( HINTERNET hsocket, USHORT status, void *r
return ERROR_INVALID_OPERATION; return ERROR_INVALID_OPERATION;
} }
socket->state = SOCKET_STATE_SHUTDOWN;
if (socket->request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) if (socket->request->connect->hdr.flags & WINHTTP_FLAG_ASYNC)
{ {
struct socket_shutdown *s; struct socket_shutdown *s;
......
...@@ -814,6 +814,11 @@ static void test_websocket(BOOL secure) ...@@ -814,6 +814,11 @@ static void test_websocket(BOOL secure)
setup_test( &info, winhttp_websocket_shutdown, __LINE__ ); setup_test( &info, winhttp_websocket_shutdown, __LINE__ );
err = pWinHttpWebSocketShutdown( socket, 1000, (void *)"success", sizeof("success") ); err = pWinHttpWebSocketShutdown( socket, 1000, (void *)"success", sizeof("success") );
ok( err == ERROR_SUCCESS, "got %u\n", err ); ok( err == ERROR_SUCCESS, "got %u\n", err );
err = pWinHttpWebSocketSend( socket, WINHTTP_WEB_SOCKET_BINARY_MESSAGE_BUFFER_TYPE,
(void*)"hello", sizeof("hello") );
ok( err == ERROR_INVALID_OPERATION, "got %u\n", err );
WaitForSingleObject( info.wait, INFINITE ); WaitForSingleObject( info.wait, INFINITE );
err = pWinHttpWebSocketShutdown( socket, 1000, (void *)"success", sizeof("success") ); err = pWinHttpWebSocketShutdown( socket, 1000, (void *)"success", sizeof("success") );
......
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