winhttp: Count queued websocket receive operations.

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-26 15:25:21 +01:00 committed by Alexandre Julliard
parent 52b00214a2
commit 2a812a5645
2 changed files with 10 additions and 0 deletions

View File

@ -3244,6 +3244,12 @@ static void send_io_complete( struct object_header *hdr )
assert( count >= 0 );
}
static void receive_io_complete( struct socket *socket )
{
LONG count = InterlockedDecrement( &socket->hdr.pending_receives );
assert( count >= 0 );
}
static enum socket_opcode map_buffer_type( WINHTTP_WEB_SOCKET_BUFFER_TYPE type )
{
switch (type)
@ -3614,6 +3620,7 @@ static void CALLBACK task_socket_receive( TP_CALLBACK_INSTANCE *instance, void *
TRACE("running %p\n", work);
ret = socket_receive( r->socket, r->buf, r->len, &count, &type );
receive_io_complete( r->socket );
if (!ret)
{
@ -3667,8 +3674,10 @@ DWORD WINAPI WinHttpWebSocketReceive( HINTERNET hsocket, void *buf, DWORD len, D
r->len = len;
addref_object( &socket->hdr );
InterlockedIncrement( &socket->hdr.pending_receives );
if ((ret = queue_task( &socket->recv_q, task_socket_receive, r )))
{
InterlockedDecrement( &socket->hdr.pending_receives );
release_object( &socket->hdr );
free( r );
}

View File

@ -52,6 +52,7 @@ struct object_header
LONG recursion_count;
struct list entry;
volatile LONG pending_sends;
volatile LONG pending_receives;
};
struct hostdata