From ac6325e4bbfa6ba9ace5c98787ef770325ddf051 Mon Sep 17 00:00:00 2001
From: Jacek Caban <jacek@codeweavers.com>
Date: Wed, 27 Sep 2017 20:18:07 +0200
Subject: [PATCH] rpcrt4: Wait for available pipe when connecting to busy
 server.

It's most likely to happen when server just accepted another connection
and didn't create a new listening pipe instance yet.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
---
 dlls/rpcrt4/rpc_transport.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c
index 5735b0f58e1..c374ba1ccb1 100644
--- a/dlls/rpcrt4/rpc_transport.c
+++ b/dlls/rpcrt4/rpc_transport.c
@@ -153,6 +153,10 @@ static RPC_STATUS rpcrt4_conn_open_pipe(RpcConnection *Connection, LPCSTR pname,
     if (pipe != INVALID_HANDLE_VALUE) break;
     err = GetLastError();
     if (err == ERROR_PIPE_BUSY) {
+      if (WaitNamedPipeA(pname, NMPWAIT_USE_DEFAULT_WAIT)) {
+        TRACE("retrying busy server\n");
+        continue;
+      }
       TRACE("connection failed, error=%x\n", err);
       return RPC_S_SERVER_TOO_BUSY;
     }
-- 
GitLab