Hans Leidekker : webservices: Add async support in WsSendReplyMessage.

Alexandre Julliard julliard at winehq.org
Wed May 19 14:55:13 CDT 2021


Module: wine
Branch: master
Commit: bebffaf9e7a83964af4c63c606e35f86cedbc025
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=bebffaf9e7a83964af4c63c606e35f86cedbc025

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Wed May 19 09:32:09 2021 +0200

webservices: Add async support in WsSendReplyMessage.

Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/webservices/channel.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/dlls/webservices/channel.c b/dlls/webservices/channel.c
index 7e576544205..430453443d0 100644
--- a/dlls/webservices/channel.c
+++ b/dlls/webservices/channel.c
@@ -1738,12 +1738,13 @@ HRESULT WINAPI WsSendReplyMessage( WS_CHANNEL *handle, WS_MESSAGE *msg, const WS
                                    const WS_ASYNC_CONTEXT *ctx, WS_ERROR *error )
 {
     struct channel *channel = (struct channel *)handle;
-    GUID req_id;
+    WS_ASYNC_CONTEXT ctx_local;
+    struct async async;
+    GUID id;
     HRESULT hr;
 
     TRACE( "%p %p %p %08x %p %u %p %p %p\n", handle, msg, desc, option, body, size, request, ctx, error );
     if (error) FIXME( "ignoring error parameter\n" );
-    if (ctx) FIXME( "ignoring ctx parameter\n" );
 
     if (!channel || !msg || !desc || !request) return E_INVALIDARG;
 
@@ -1760,15 +1761,16 @@ HRESULT WINAPI WsSendReplyMessage( WS_CHANNEL *handle, WS_MESSAGE *msg, const WS
         return WS_E_INVALID_OPERATION;
     }
 
-    if ((hr = WsInitializeMessage( msg, WS_REPLY_MESSAGE, NULL, NULL )) != S_OK) goto done;
-    if ((hr = WsAddressMessage( msg, &channel->addr, NULL )) != S_OK) goto done;
-    if ((hr = message_set_action( msg, desc->action )) != S_OK) goto done;
-    if ((hr = message_get_id( request, &req_id )) != S_OK) goto done;
-    if ((hr = message_set_request_id( msg, &req_id )) != S_OK) goto done;
+    if ((hr = message_get_id( request, &id )) != S_OK) goto done;
+    if ((hr = message_set_request_id( msg, &id )) != S_OK) goto done;
 
-    if ((hr = init_writer( channel )) != S_OK) goto done;
-    if ((hr = write_message( channel, msg, desc->bodyElementDescription, option, body, size )) != S_OK) goto done;
-    hr = send_message_bytes( channel, msg );
+    if (!ctx) async_init( &async, &ctx_local );
+    hr = queue_send_message( channel, msg, desc, option, body, size, ctx ? ctx : &ctx_local );
+    if (!ctx)
+    {
+        if (hr == WS_S_ASYNC) hr = async_wait( &async );
+        CloseHandle( async.done );
+    }
 
 done:
     LeaveCriticalSection( &channel->cs );
@@ -2387,14 +2389,9 @@ static HRESULT request_reply( struct channel *channel, WS_MESSAGE *request,
                               WS_HEAP *heap, void *value, ULONG size )
 {
     HRESULT hr;
-    WsInitializeMessage( request, WS_REQUEST_MESSAGE, NULL, NULL );
-    if ((hr = WsAddressMessage( request, &channel->addr, NULL )) != S_OK) return hr;
-    if ((hr = message_set_action( request, request_desc->action )) != S_OK) return hr;
 
-    if ((hr = init_writer( channel )) != S_OK) return hr;
-    if ((hr = write_message( channel, request, request_desc->bodyElementDescription, write_option, request_body,
-                             request_size )) != S_OK) return hr;
-    if ((hr = send_message_bytes( channel, request )) != S_OK) return hr;
+    if ((hr = send_message( channel, request, request_desc, write_option, request_body, request_size )) != S_OK)
+        return hr;
 
     return receive_message( channel, reply, &reply_desc, 1, WS_RECEIVE_OPTIONAL_MESSAGE, read_option, heap,
                             value, size, NULL );




More information about the wine-cvs mailing list