rpcrt4: Properly handle the case of a client having disconnected in rpcrt4_conn_listen_pipe.

This commit is contained in:
Alexandre Julliard 2008-06-09 12:56:42 +02:00
parent c41a903969
commit 853db9a79d
1 changed files with 21 additions and 12 deletions

View File

@ -118,21 +118,30 @@ static RPC_STATUS rpcrt4_conn_listen_pipe(RpcConnection_np *npc)
return RPC_S_OK;
npc->listening = TRUE;
for (;;)
{
if (ConnectNamedPipe(npc->pipe, &npc->ovl))
return RPC_S_OK;
if (GetLastError() == ERROR_PIPE_CONNECTED) {
switch(GetLastError())
{
case ERROR_PIPE_CONNECTED:
SetEvent(npc->ovl.hEvent);
return RPC_S_OK;
}
if (GetLastError() == ERROR_IO_PENDING) {
case ERROR_IO_PENDING:
/* will be completed in rpcrt4_protseq_np_wait_for_new_connection */
return RPC_S_OK;
}
case ERROR_NO_DATA_DETECTED:
/* client has disconnected, retry */
DisconnectNamedPipe( npc->pipe );
break;
default:
npc->listening = FALSE;
WARN("Couldn't ConnectNamedPipe (error was %d)\n", GetLastError());
return RPC_S_OUT_OF_RESOURCES;
}
}
}
static RPC_STATUS rpcrt4_conn_create_pipe(RpcConnection *Connection, LPCSTR pname)
{