Hans Leidekker : webservices: Add async support in WsShutdownSessionChannel.
Alexandre Julliard
julliard at winehq.org
Tue May 18 15:42:37 CDT 2021
Module: wine
Branch: master
Commit: 6bc9748a6fc1b1a0278e1808cb18897f9230a6bc
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6bc9748a6fc1b1a0278e1808cb18897f9230a6bc
Author: Hans Leidekker <hans at codeweavers.com>
Date: Tue May 18 17:19:43 2021 +0200
webservices: Add async support in WsShutdownSessionChannel.
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/webservices/channel.c | 41 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 39 insertions(+), 2 deletions(-)
diff --git a/dlls/webservices/channel.c b/dlls/webservices/channel.c
index 76b0c1a96e2..539a7813605 100644
--- a/dlls/webservices/channel.c
+++ b/dlls/webservices/channel.c
@@ -820,14 +820,45 @@ static HRESULT shutdown_session( struct channel *channel )
}
}
+struct shutdown_session
+{
+ struct task task;
+ struct channel *channel;
+ WS_ASYNC_CONTEXT ctx;
+};
+
+static void shutdown_session_proc( struct task *task )
+{
+ struct shutdown_session *s = (struct shutdown_session *)task;
+ HRESULT hr;
+
+ hr = shutdown_session( s->channel );
+
+ TRACE( "calling %p(%08x)\n", s->ctx.callback, hr );
+ s->ctx.callback( hr, WS_LONG_CALLBACK, s->ctx.callbackState );
+ TRACE( "%p returned\n", s->ctx.callback );
+}
+
+static HRESULT queue_shutdown_session( struct channel *channel, const WS_ASYNC_CONTEXT *ctx )
+{
+ struct shutdown_session *s;
+
+ if (!(s = heap_alloc( sizeof(*s) ))) return E_OUTOFMEMORY;
+ s->task.proc = shutdown_session_proc;
+ s->channel = channel;
+ s->ctx = *ctx;
+ return queue_task( &channel->send_q, &s->task );
+}
+
HRESULT WINAPI WsShutdownSessionChannel( WS_CHANNEL *handle, const WS_ASYNC_CONTEXT *ctx, WS_ERROR *error )
{
struct channel *channel = (struct channel *)handle;
+ WS_ASYNC_CONTEXT ctx_local;
+ struct async async;
HRESULT hr;
TRACE( "%p %p %p\n", handle, ctx, error );
if (error) FIXME( "ignoring error parameter\n" );
- if (ctx) FIXME( "ignoring ctx parameter\n" );
if (!channel) return E_INVALIDARG;
@@ -844,7 +875,13 @@ HRESULT WINAPI WsShutdownSessionChannel( WS_CHANNEL *handle, const WS_ASYNC_CONT
return WS_E_INVALID_OPERATION;
}
- hr = shutdown_session( channel );
+ if (!ctx) async_init( &async, &ctx_local );
+ hr = queue_shutdown_session( channel, ctx ? ctx : &ctx_local );
+ if (!ctx)
+ {
+ if (hr == WS_S_ASYNC) hr = async_wait( &async );
+ CloseHandle( async.done );
+ }
LeaveCriticalSection( &channel->cs );
TRACE( "returning %08x\n", hr );
More information about the wine-cvs
mailing list