Commit 50171c5c authored by Alexandre Julliard's avatar Alexandre Julliard

server: Make the new named pipe server fd inherit the I/O completion if it was…

server: Make the new named pipe server fd inherit the I/O completion if it was set before connecting.
parent 9dd3fe54
......@@ -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 );
......
......@@ -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 */
......
......@@ -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)
......
......@@ -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 );
......
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