Commit 97f9dc7f authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winhttp: Stop the send queue before sending the close message.

parent dffd8e86
......@@ -138,6 +138,14 @@ static DWORD start_queue( struct queue *queue )
return ERROR_SUCCESS;
}
void stop_queue( struct queue *queue )
{
if (!queue->pool) return;
CloseThreadpool( queue->pool );
queue->pool = NULL;
TRACE("stopped %p\n", queue);
}
static DWORD queue_task( struct queue *queue, PTP_WORK_CALLBACK task, void *ctx )
{
TP_WORK *work;
......@@ -3037,8 +3045,8 @@ static void socket_destroy( struct object_header *hdr )
TRACE("%p\n", socket);
if (socket->send_q.pool) CloseThreadpool( socket->send_q.pool );
if (socket->recv_q.pool) CloseThreadpool( socket->recv_q.pool );
stop_queue( &socket->send_q );
stop_queue( &socket->recv_q );
release_object( &socket->request->hdr );
heap_free( socket );
......@@ -3526,6 +3534,7 @@ static DWORD socket_shutdown( struct socket *socket, USHORT status, const void *
struct netconn *netconn = socket->request->netconn;
DWORD ret;
stop_queue( &socket->send_q );
if (!(ret = send_frame( netconn, SOCKET_OPCODE_CLOSE, status, reason, len, TRUE )))
{
socket->state = SOCKET_STATE_SHUTDOWN;
......@@ -3609,6 +3618,7 @@ static DWORD socket_close( struct socket *socket, USHORT status, const void *rea
if (socket->state < SOCKET_STATE_SHUTDOWN)
{
stop_queue( &socket->send_q );
if ((ret = send_frame( netconn, SOCKET_OPCODE_CLOSE, status, reason, len, TRUE ))) goto done;
socket->state = SOCKET_STATE_SHUTDOWN;
}
......
......@@ -578,7 +578,7 @@ static void request_destroy( struct object_header *hdr )
TRACE("%p\n", request);
if (request->queue.pool) CloseThreadpool( request->queue.pool );
stop_queue( &request->queue );
release_object( &request->connect->hdr );
if (request->cred_handle_initialized) FreeCredentialsHandle( &request->cred_handle );
......
......@@ -317,6 +317,7 @@ BOOL free_handle( HINTERNET ) DECLSPEC_HIDDEN;
void send_callback( struct object_header *, DWORD, LPVOID, DWORD ) DECLSPEC_HIDDEN;
void close_connection( struct request * ) DECLSPEC_HIDDEN;
void stop_queue( struct queue * ) DECLSPEC_HIDDEN;
void netconn_close( struct netconn * ) DECLSPEC_HIDDEN;
DWORD netconn_create( struct hostdata *, const struct sockaddr_storage *, int, struct netconn ** ) DECLSPEC_HIDDEN;
......
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