server: Don't block when reading from named pipes in PIPE_NOWAIT mode.
Fixes Rockstar Games Launcher hanging for some users. 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:
parent
11a554eecc
commit
abb1ce1087
|
@ -3910,7 +3910,7 @@ static void test_nowait(void)
|
|||
ol.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
|
||||
SetLastError(0xdeadbeef);
|
||||
ok(ReadFile(piperead, readbuf, sizeof(readbuf), &read, &ol) == FALSE, "ReadFile should fail\n");
|
||||
todo_wine ok(GetLastError() == ERROR_NO_DATA, "got %d should be ERROR_NO_DATA\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_NO_DATA, "got %d should be ERROR_NO_DATA\n", GetLastError());
|
||||
if (GetLastError() == ERROR_IO_PENDING)
|
||||
CancelIo(piperead);
|
||||
|
||||
|
|
|
@ -851,6 +851,11 @@ static int pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos )
|
|||
switch (pipe_end->state)
|
||||
{
|
||||
case FILE_PIPE_CONNECTED_STATE:
|
||||
if ((pipe_end->flags & NAMED_PIPE_NONBLOCKING_MODE) && list_empty( &pipe_end->message_queue ))
|
||||
{
|
||||
set_error( STATUS_PIPE_EMPTY );
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case FILE_PIPE_DISCONNECTED_STATE:
|
||||
set_error( STATUS_PIPE_DISCONNECTED );
|
||||
|
|
Loading…
Reference in New Issue