server: Always try return a named pipe server that is listening from find_available_server.

We still fallback to an idle server, but this prevents a client from
connecting to a named pipe server that isn't listening.
This commit is contained in:
Rob Shearman 2008-02-04 20:18:34 +00:00 committed by Alexandre Julliard
parent e70848ed01
commit 44581af935
1 changed files with 10 additions and 1 deletions

View File

@ -772,11 +772,20 @@ static struct pipe_server *find_available_server( struct named_pipe *pipe )
{
struct pipe_server *server;
/* look for pipe servers that are listening */
LIST_FOR_EACH_ENTRY( server, &pipe->servers, struct pipe_server, entry )
{
if (server->state == ps_idle_server || server->state == ps_wait_open)
if (server->state == ps_wait_open)
return (struct pipe_server *)grab_object( server );
}
/* fall back to pipe servers that are idle */
LIST_FOR_EACH_ENTRY( server, &pipe->servers, struct pipe_server, entry )
{
if (server->state == ps_idle_server)
return (struct pipe_server *)grab_object( server );
}
return NULL;
}