server: Don't block ConnectNamedPipe for pipe in PIPE_NOWAIT mode.

Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Brendan Shanks 2019-10-16 14:50:45 +02:00 committed by Alexandre Julliard
parent 91c4e9bf9a
commit 41374ef196
2 changed files with 7 additions and 2 deletions

View File

@ -4026,7 +4026,7 @@ static void test_nowait(void)
ol.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
SetLastError(0xdeadbeef);
ok(ConnectNamedPipe(pipewrite, &ol) == FALSE, "ConnectNamedPipe should fail\n");
todo_wine ok(GetLastError() == ERROR_PIPE_LISTENING, "got %d should be ERROR_PIPE_LISTENING\n", GetLastError());
ok(GetLastError() == ERROR_PIPE_LISTENING, "got %d should be ERROR_PIPE_LISTENING\n", GetLastError());
if (GetLastError() == ERROR_IO_PENDING)
CancelIo(pipewrite);
@ -4044,7 +4044,7 @@ static void test_nowait(void)
ok(DisconnectNamedPipe(pipewrite) == TRUE, "DisconnectNamedPipe should succeed\n");
SetLastError(0xdeadbeef);
ok(ConnectNamedPipe(pipewrite,&ol) == FALSE, "ConnectNamedPipe should fail\n");
todo_wine ok(GetLastError() == ERROR_PIPE_LISTENING, "got %d should be ERROR_PIPE_LISTENING\n", GetLastError());
ok(GetLastError() == ERROR_PIPE_LISTENING, "got %d should be ERROR_PIPE_LISTENING\n", GetLastError());
if (GetLastError() == ERROR_IO_PENDING)
CancelIo(pipewrite);
ok(CloseHandle(ol.hEvent), "CloseHandle for the event failed\n");

View File

@ -1106,6 +1106,11 @@ static int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *as
return 0;
}
if (server->pipe_end.flags & NAMED_PIPE_NONBLOCKING_MODE)
{
set_error( STATUS_PIPE_LISTENING );
return 0;
}
queue_async( &server->listen_q, async );
async_wake_up( &server->pipe_end.pipe->waiters, STATUS_SUCCESS );
set_error( STATUS_PENDING );