server: Store pipe state in pipe_end struct and return it in FSCTL_PIPE_PEEK.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5efd706c22
commit
8e5bc0daf7
|
@ -1290,7 +1290,6 @@ static void test_pipe_state(HANDLE pipe, BOOL is_server, DWORD state)
|
||||||
ok(status == expected_status, "status = %x, expected %x in %s state %u\n",
|
ok(status == expected_status, "status = %x, expected %x in %s state %u\n",
|
||||||
status, expected_status, is_server ? "server" : "client", state);
|
status, expected_status, is_server ? "server" : "client", state);
|
||||||
if (!status)
|
if (!status)
|
||||||
todo_wine
|
|
||||||
ok(peek_buf.NamedPipeState == state, "NamedPipeState = %u, expected %u\n",
|
ok(peek_buf.NamedPipeState == state, "NamedPipeState = %u, expected %u\n",
|
||||||
peek_buf.NamedPipeState, state);
|
peek_buf.NamedPipeState, state);
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,7 @@ struct pipe_end
|
||||||
struct object obj; /* object header */
|
struct object obj; /* object header */
|
||||||
struct fd *fd; /* pipe file descriptor */
|
struct fd *fd; /* pipe file descriptor */
|
||||||
unsigned int flags; /* pipe flags */
|
unsigned int flags; /* pipe flags */
|
||||||
|
unsigned int state; /* pipe state */
|
||||||
struct pipe_end *connection; /* the other end of the pipe */
|
struct pipe_end *connection; /* the other end of the pipe */
|
||||||
process_id_t client_pid; /* process that created the client */
|
process_id_t client_pid; /* process that created the client */
|
||||||
process_id_t server_pid; /* process that created the server */
|
process_id_t server_pid; /* process that created the server */
|
||||||
|
@ -394,6 +395,8 @@ static void pipe_end_disconnect( struct pipe_end *pipe_end, unsigned int status
|
||||||
|
|
||||||
pipe_end->connection = NULL;
|
pipe_end->connection = NULL;
|
||||||
|
|
||||||
|
pipe_end->state = status == STATUS_PIPE_DISCONNECTED
|
||||||
|
? FILE_PIPE_DISCONNECTED_STATE : FILE_PIPE_CLOSING_STATE;
|
||||||
fd_async_wake_up( pipe_end->fd, ASYNC_TYPE_WAIT, status );
|
fd_async_wake_up( pipe_end->fd, ASYNC_TYPE_WAIT, status );
|
||||||
async_wake_up( &pipe_end->read_q, status );
|
async_wake_up( &pipe_end->read_q, status );
|
||||||
LIST_FOR_EACH_ENTRY_SAFE( message, next, &pipe_end->message_queue, struct pipe_message, entry )
|
LIST_FOR_EACH_ENTRY_SAFE( message, next, &pipe_end->message_queue, struct pipe_message, entry )
|
||||||
|
@ -883,7 +886,7 @@ static int pipe_end_peek( struct pipe_end *pipe_end )
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(buffer = set_reply_data_size( offsetof( FILE_PIPE_PEEK_BUFFER, Data[reply_size] )))) return 0;
|
if (!(buffer = set_reply_data_size( offsetof( FILE_PIPE_PEEK_BUFFER, Data[reply_size] )))) return 0;
|
||||||
buffer->NamedPipeState = 0; /* FIXME */
|
buffer->NamedPipeState = pipe_end->state;
|
||||||
buffer->ReadDataAvailable = avail;
|
buffer->ReadDataAvailable = avail;
|
||||||
buffer->NumberOfMessages = 0; /* FIXME */
|
buffer->NumberOfMessages = 0; /* FIXME */
|
||||||
buffer->MessageLength = message_length;
|
buffer->MessageLength = message_length;
|
||||||
|
@ -1005,6 +1008,7 @@ static int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *as
|
||||||
case ps_idle_server:
|
case ps_idle_server:
|
||||||
case ps_wait_connect:
|
case ps_wait_connect:
|
||||||
fd_queue_async( server->pipe_end.fd, async, ASYNC_TYPE_WAIT );
|
fd_queue_async( server->pipe_end.fd, async, ASYNC_TYPE_WAIT );
|
||||||
|
server->pipe_end.state = FILE_PIPE_LISTENING_STATE;
|
||||||
set_server_state( server, ps_wait_open );
|
set_server_state( server, ps_wait_open );
|
||||||
async_wake_up( &server->pipe->waiters, STATUS_SUCCESS );
|
async_wake_up( &server->pipe->waiters, STATUS_SUCCESS );
|
||||||
set_error( STATUS_PENDING );
|
set_error( STATUS_PENDING );
|
||||||
|
@ -1100,6 +1104,7 @@ static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned
|
||||||
server->client = NULL;
|
server->client = NULL;
|
||||||
server->options = options;
|
server->options = options;
|
||||||
init_pipe_end( &server->pipe_end, pipe_flags, pipe->insize );
|
init_pipe_end( &server->pipe_end, pipe_flags, pipe->insize );
|
||||||
|
server->pipe_end.state = FILE_PIPE_LISTENING_STATE;
|
||||||
server->pipe_end.server_pid = get_process_id( current->process );
|
server->pipe_end.server_pid = get_process_id( current->process );
|
||||||
|
|
||||||
list_add_head( &pipe->servers, &server->entry );
|
list_add_head( &pipe->servers, &server->entry );
|
||||||
|
@ -1126,6 +1131,7 @@ static struct pipe_client *create_pipe_client( unsigned int flags, unsigned int
|
||||||
client->server = NULL;
|
client->server = NULL;
|
||||||
client->flags = flags;
|
client->flags = flags;
|
||||||
init_pipe_end( &client->pipe_end, pipe_flags, buffer_size );
|
init_pipe_end( &client->pipe_end, pipe_flags, buffer_size );
|
||||||
|
client->pipe_end.state = FILE_PIPE_CONNECTED_STATE;
|
||||||
client->pipe_end.client_pid = get_process_id( current->process );
|
client->pipe_end.client_pid = get_process_id( current->process );
|
||||||
|
|
||||||
client->pipe_end.fd = alloc_pseudo_fd( &pipe_client_fd_ops, &client->pipe_end.obj, options );
|
client->pipe_end.fd = alloc_pseudo_fd( &pipe_client_fd_ops, &client->pipe_end.obj, options );
|
||||||
|
@ -1204,6 +1210,7 @@ static struct object *named_pipe_open_file( struct object *obj, unsigned int acc
|
||||||
allow_fd_caching( server->pipe_end.fd );
|
allow_fd_caching( server->pipe_end.fd );
|
||||||
if (server->state == ps_wait_open)
|
if (server->state == ps_wait_open)
|
||||||
fd_async_wake_up( server->pipe_end.fd, ASYNC_TYPE_WAIT, STATUS_SUCCESS );
|
fd_async_wake_up( server->pipe_end.fd, ASYNC_TYPE_WAIT, STATUS_SUCCESS );
|
||||||
|
server->pipe_end.state = FILE_PIPE_CONNECTED_STATE;
|
||||||
set_server_state( server, ps_connected_server );
|
set_server_state( server, ps_connected_server );
|
||||||
server->client = client;
|
server->client = client;
|
||||||
client->server = server;
|
client->server = server;
|
||||||
|
|
Loading…
Reference in New Issue