Alexandre Julliard : server: Make the new named pipe server fd inherit the I/ O completion if it was set before connecting.

Alexandre Julliard julliard at winehq.org
Tue Mar 3 11:53:39 CST 2009


Module: wine
Branch: master
Commit: 50171c5cc1c0c04bdca2fd2aeaa3ba8168c7236f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=50171c5cc1c0c04bdca2fd2aeaa3ba8168c7236f

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Mar  2 20:34:39 2009 +0100

server: Make the new named pipe server fd inherit the I/O completion if it was set before connecting.

---

 server/async.c      |    2 +-
 server/fd.c         |   10 ++++++++--
 server/file.h       |    3 ++-
 server/named_pipe.c |    1 +
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/server/async.c b/server/async.c
index 0a69f7a..91f0c44 100644
--- a/server/async.c
+++ b/server/async.c
@@ -214,7 +214,7 @@ struct async *create_async( struct thread *thread, struct async_queue *queue, co
     async->timeout = NULL;
     async->queue   = (struct async_queue *)grab_object( queue );
     async->completion = NULL;
-    if (queue->fd) fd_assign_completion( queue->fd, &async->completion, &async->comp_key );
+    if (queue->fd) async->completion = fd_get_completion( queue->fd, &async->comp_key );
 
     list_add_tail( &queue->queue, &async->queue_entry );
     grab_object( async );
diff --git a/server/fd.c b/server/fd.c
index c8b6f7a..d9688e1 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -1940,10 +1940,16 @@ static struct fd *get_handle_fd_obj( struct process *process, obj_handle_t handl
     return fd;
 }
 
-void fd_assign_completion( struct fd *fd, struct completion **p_port, apc_param_t *p_key )
+struct completion *fd_get_completion( struct fd *fd, apc_param_t *p_key )
 {
     *p_key = fd->comp_key;
-    *p_port = fd->completion ? (struct completion *)grab_object( fd->completion ) : NULL;
+    return fd->completion ? (struct completion *)grab_object( fd->completion ) : NULL;
+}
+
+void fd_copy_completion( struct fd *src, struct fd *dst )
+{
+    assert( !dst->completion );
+    dst->completion = fd_get_completion( src, &dst->comp_key );
 }
 
 /* flush a file buffers */
diff --git a/server/file.h b/server/file.h
index 0eac537..1aaa284 100644
--- a/server/file.h
+++ b/server/file.h
@@ -143,7 +143,8 @@ extern void async_set_result( struct object *obj, unsigned int status,
 extern int async_waiting( struct async_queue *queue );
 extern void async_terminate( struct async *async, unsigned int status );
 extern void async_wake_up( struct async_queue *queue, unsigned int status );
-extern void fd_assign_completion( struct fd *fd, struct completion **p_port, apc_param_t *p_key );
+extern struct completion *fd_get_completion( struct fd *fd, apc_param_t *p_key );
+extern void fd_copy_completion( struct fd *src, struct fd *dst );
 
 /* access rights that require Unix read permission */
 #define FILE_UNIX_READ_ACCESS (FILE_READ_DATA|FILE_READ_ATTRIBUTES|FILE_READ_EA)
diff --git a/server/named_pipe.c b/server/named_pipe.c
index c4d1993..539509e 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -830,6 +830,7 @@ static struct object *named_pipe_open_file( struct object *obj, unsigned int acc
             server->fd = create_anonymous_fd( &pipe_server_fd_ops, fds[0], &server->obj, server->options );
             if (client->fd && server->fd)
             {
+                fd_copy_completion( server->ioctl_fd, server->fd );
                 if (server->state == ps_wait_open)
                     fd_async_wake_up( server->ioctl_fd, ASYNC_TYPE_WAIT, STATUS_SUCCESS );
                 set_server_state( server, ps_connected_server );




More information about the wine-cvs mailing list