Commit 6a98d5f5 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winhttp: Make the task queue implementation more generic.

parent 5c4f1e4c
......@@ -578,11 +578,11 @@ static void request_destroy( struct object_header *hdr )
TRACE("%p\n", request);
if (request->task_proc_running)
if (request->queue.proc_running)
{
/* Signal to the task proc to quit. It will call this again when it does. */
request->task_proc_running = FALSE;
SetEvent( request->task_cancel );
request->queue.proc_running = FALSE;
SetEvent( request->queue.cancel );
return;
}
release_object( &request->connect->hdr );
......@@ -613,6 +613,9 @@ static void request_destroy( struct object_header *hdr )
heap_free( request->creds[i][j].password );
}
}
request->queue.cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection( &request->queue.cs );
heap_free( request );
}
......@@ -1117,7 +1120,8 @@ HINTERNET WINAPI WinHttpOpenRequest( HINTERNET hconnect, LPCWSTR verb, LPCWSTR o
request->hdr.notify_mask = connect->hdr.notify_mask;
request->hdr.context = connect->hdr.context;
request->hdr.redirect_policy = connect->hdr.redirect_policy;
list_init( &request->task_queue );
InitializeCriticalSection( &request->queue.cs );
request->queue.cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": request.queue.cs");
addref_object( &connect->hdr );
request->connect = connect;
......
......@@ -155,6 +155,16 @@ struct authinfo
BOOL finished; /* finished authenticating */
};
struct queue
{
struct object_header *object;
CRITICAL_SECTION cs;
BOOL proc_running;
HANDLE wait;
HANDLE cancel;
struct list tasks;
};
enum request_flags
{
REQUEST_FLAG_WEBSOCKET_UPGRADE = 0x01,
......@@ -196,11 +206,7 @@ struct request
DWORD num_headers;
struct authinfo *authinfo;
struct authinfo *proxy_authinfo;
HANDLE task_wait;
HANDLE task_cancel;
BOOL task_proc_running;
struct list task_queue;
CRITICAL_SECTION task_cs;
struct queue queue;
struct
{
WCHAR *username;
......@@ -217,7 +223,7 @@ struct socket
struct task_header
{
struct list entry;
struct request *request;
struct object_header *object;
void (*proc)( struct task_header * );
};
......
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