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:
parent
1c3769a03d
commit
9327d9b56c
@ -94,11 +94,12 @@ 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);
|
||||||
|
|
||||||
|
for (i = 0; i < 5; i++) {
|
||||||
hPipe = CreateFile(
|
hPipe = CreateFile(
|
||||||
XTIER_RPC_PIPE,
|
XTIER_RPC_PIPE,
|
||||||
GENERIC_READ | GENERIC_WRITE,
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
@ -108,9 +109,22 @@ void * ipc_win_create()
|
|||||||
0,
|
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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user