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

This commit is contained in:
Alexandre Julliard 2009-03-02 20:34:39 +01:00
parent 9dd3fe5467
commit 50171c5cc1
4 changed files with 12 additions and 4 deletions

View File

@ -214,7 +214,7 @@ struct async *create_async( struct thread *thread, struct async_queue *queue, co
async->timeout = NULL; async->timeout = NULL;
async->queue = (struct async_queue *)grab_object( queue ); async->queue = (struct async_queue *)grab_object( queue );
async->completion = NULL; 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 ); list_add_tail( &queue->queue, &async->queue_entry );
grab_object( async ); grab_object( async );

View File

@ -1940,10 +1940,16 @@ static struct fd *get_handle_fd_obj( struct process *process, obj_handle_t handl
return fd; 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_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 */ /* flush a file buffers */

View File

@ -143,7 +143,8 @@ extern void async_set_result( struct object *obj, unsigned int status,
extern int async_waiting( struct async_queue *queue ); extern int async_waiting( struct async_queue *queue );
extern void async_terminate( struct async *async, unsigned int status ); extern void async_terminate( struct async *async, unsigned int status );
extern void async_wake_up( struct async_queue *queue, 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 */ /* access rights that require Unix read permission */
#define FILE_UNIX_READ_ACCESS (FILE_READ_DATA|FILE_READ_ATTRIBUTES|FILE_READ_EA) #define FILE_UNIX_READ_ACCESS (FILE_READ_DATA|FILE_READ_ATTRIBUTES|FILE_READ_EA)

View File

@ -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 ); server->fd = create_anonymous_fd( &pipe_server_fd_ops, fds[0], &server->obj, server->options );
if (client->fd && server->fd) if (client->fd && server->fd)
{ {
fd_copy_completion( server->ioctl_fd, server->fd );
if (server->state == ps_wait_open) if (server->state == ps_wait_open)
fd_async_wake_up( server->ioctl_fd, ASYNC_TYPE_WAIT, STATUS_SUCCESS ); fd_async_wake_up( server->ioctl_fd, ASYNC_TYPE_WAIT, STATUS_SUCCESS );
set_server_state( server, ps_connected_server ); set_server_state( server, ps_connected_server );