Bug#489688: While trying to open named pipe to talk to micasad, micasa

client may get an error ERROR_PIPE_BUSY. Client has to retry operation.
This commit is contained in:
S Rahul 2009-04-15 04:21:32 +00:00
parent 1c3769a03d
commit 9327d9b56c

View File

@ -94,23 +94,37 @@ void * ipc_win_create()
//#ifdef SSCS_WIN32_PLAT_F //#ifdef SSCS_WIN32_PLAT_F
// connect to the named Pipe // connect to the named Pipe
HANDLE hPipe = NULL; HANDLE hPipe = NULL;
int rcode; int rcode = 0, i;
DWORD mode = PIPE_READMODE_MESSAGE; DWORD mode = PIPE_READMODE_MESSAGE;
DbgTrace(1, " -ipc_win_create- start\n", 0); DbgTrace(1, " -ipc_win_create- start\n", 0);
hPipe = CreateFile( for (i = 0; i < 5; i++) {
XTIER_RPC_PIPE, hPipe = CreateFile(
GENERIC_READ | GENERIC_WRITE, XTIER_RPC_PIPE,
0, GENERIC_READ | GENERIC_WRITE,
NULL, //null, 0,
OPEN_EXISTING, NULL, //null,
0, OPEN_EXISTING,
0); 0,
0);
if (hPipe != INVALID_HANDLE_VALUE)
break;
rcode = GetLastError();
if (rcode != ERROR_PIPE_BUSY)
break;
if (!WaitNamedPipe(XTIER_RPC_PIPE, 5000)) {
rcode = GetLastError();
break;
}
}
if (hPipe == INVALID_HANDLE_VALUE) if (hPipe == INVALID_HANDLE_VALUE)
{ {
rcode = GetLastError();
DbgTrace(0, " Create Pipe error:%d\r\n", rcode); DbgTrace(0, " Create Pipe error:%d\r\n", rcode);
return -1; return -1;
} }