Commit 975c5381 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

server: Added support for flushing client pipe.

parent aa472f5e
...@@ -2853,6 +2853,9 @@ static void test_overlapped_transport(BOOL msg_mode, BOOL msg_read_mode) ...@@ -2853,6 +2853,9 @@ static void test_overlapped_transport(BOOL msg_mode, BOOL msg_read_mode)
trace("testing %s, %s server->client writes...\n", trace("testing %s, %s server->client writes...\n",
msg_mode ? "message mode" : "byte mode", msg_read_mode ? "message read" : "byte read"); msg_mode ? "message mode" : "byte mode", msg_read_mode ? "message read" : "byte read");
test_blocking_rw(server, client, 5000, msg_mode, msg_read_mode); test_blocking_rw(server, client, 5000, msg_mode, msg_read_mode);
trace("testing %s, %s client->server writes...\n",
msg_mode ? "message mode" : "byte mode", msg_read_mode ? "message read" : "byte read");
test_blocking_rw(client, server, 6000, msg_mode, msg_read_mode);
CloseHandle(client); CloseHandle(client);
CloseHandle(server); CloseHandle(server);
...@@ -2869,18 +2872,22 @@ static void test_overlapped_transport(BOOL msg_mode, BOOL msg_read_mode) ...@@ -2869,18 +2872,22 @@ static void test_overlapped_transport(BOOL msg_mode, BOOL msg_read_mode)
/* close server with pending writes */ /* close server with pending writes */
create_overlapped_pipe(create_flags, &client, &server); create_overlapped_pipe(create_flags, &client, &server);
overlapped_write_async(client, buf, 7000, &overlapped); overlapped_write_async(client, buf, 7000, &overlapped);
flush = test_flush_async(client, ERROR_BROKEN_PIPE);
CloseHandle(server); CloseHandle(server);
test_overlapped_failure(client, &overlapped, ERROR_BROKEN_PIPE); test_overlapped_failure(client, &overlapped, ERROR_BROKEN_PIPE);
test_flush_done(flush);
CloseHandle(client); CloseHandle(client);
/* disconnect with pending writes */ /* disconnect with pending writes */
create_overlapped_pipe(create_flags, &client, &server); create_overlapped_pipe(create_flags, &client, &server);
overlapped_write_async(client, buf, 7000, &overlapped); overlapped_write_async(client, buf, 7000, &overlapped);
overlapped_write_async(server, buf, 7000, &overlapped2); overlapped_write_async(server, buf, 7000, &overlapped2);
flush = test_flush_async(client, ERROR_PIPE_NOT_CONNECTED);
res = DisconnectNamedPipe(server); res = DisconnectNamedPipe(server);
ok(res, "DisconnectNamedPipe failed: %u\n", GetLastError()); ok(res, "DisconnectNamedPipe failed: %u\n", GetLastError());
test_overlapped_failure(client, &overlapped, ERROR_PIPE_NOT_CONNECTED); test_overlapped_failure(client, &overlapped, ERROR_PIPE_NOT_CONNECTED);
test_overlapped_failure(client, &overlapped2, ERROR_PIPE_NOT_CONNECTED); test_overlapped_failure(client, &overlapped2, ERROR_PIPE_NOT_CONNECTED);
test_flush_done(flush);
CloseHandle(server); CloseHandle(server);
CloseHandle(client); CloseHandle(client);
} }
......
...@@ -656,6 +656,9 @@ static obj_handle_t pipe_end_flush( struct pipe_end *pipe_end, struct async *asy ...@@ -656,6 +656,9 @@ static obj_handle_t pipe_end_flush( struct pipe_end *pipe_end, struct async *asy
{ {
obj_handle_t handle = 0; obj_handle_t handle = 0;
if (use_server_io( pipe_end ) && (!pipe_end->connection || list_empty( &pipe_end->connection->message_queue )))
return 0;
if (!fd_queue_async( pipe_end->fd, async, ASYNC_TYPE_WAIT )) return 0; if (!fd_queue_async( pipe_end->fd, async, ASYNC_TYPE_WAIT )) return 0;
if (!blocking || (handle = alloc_handle( current->process, async, SYNCHRONIZE, 0 ))) if (!blocking || (handle = alloc_handle( current->process, async, SYNCHRONIZE, 0 )))
...@@ -682,8 +685,9 @@ static obj_handle_t pipe_server_flush( struct fd *fd, struct async *async, int b ...@@ -682,8 +685,9 @@ static obj_handle_t pipe_server_flush( struct fd *fd, struct async *async, int b
static obj_handle_t pipe_client_flush( struct fd *fd, struct async *async, int blocking ) static obj_handle_t pipe_client_flush( struct fd *fd, struct async *async, int blocking )
{ {
/* FIXME: what do we have to do for this? */ struct pipe_end *pipe_end = get_fd_user( fd );
return 0; /* FIXME: Support byte mode. */
return use_server_io( pipe_end ) ? pipe_end_flush( pipe_end, async, blocking ) : 0;
} }
static void message_queue_read( struct pipe_end *pipe_end, struct iosb *iosb ) static void message_queue_read( struct pipe_end *pipe_end, struct iosb *iosb )
......
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