mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-30 17:14:25 +02:00
parent
b2829ca522
commit
ed90d9a847
@ -324,11 +324,15 @@ static BOOL CreatePipeOverlapped(HANDLE *outReadPipe, HANDLE *outWritePipe,
|
|||||||
SECURITY_ATTRIBUTES *securityAttributes, DWORD size, DWORD readMode, DWORD writeMode)
|
SECURITY_ATTRIBUTES *securityAttributes, DWORD size, DWORD readMode, DWORD writeMode)
|
||||||
{
|
{
|
||||||
static int pipeIndex = 0;
|
static int pipeIndex = 0;
|
||||||
|
static boost::mutex mutex;
|
||||||
|
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
size = 8192;
|
size = 8192;
|
||||||
|
|
||||||
pipeIndex++;
|
{
|
||||||
|
boost::mutex::scoped_lock lock(mutex);
|
||||||
|
pipeIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
char pipeName[128];
|
char pipeName[128];
|
||||||
sprintf(pipeName, "\\\\.\\Pipe\\OverlappedPipe.%d.%d", (int)GetCurrentProcessId(), pipeIndex);
|
sprintf(pipeName, "\\\\.\\Pipe\\OverlappedPipe.%d.%d", (int)GetCurrentProcessId(), pipeIndex);
|
||||||
@ -336,7 +340,7 @@ static BOOL CreatePipeOverlapped(HANDLE *outReadPipe, HANDLE *outWritePipe,
|
|||||||
*outReadPipe = CreateNamedPipe(pipeName, PIPE_ACCESS_INBOUND | readMode,
|
*outReadPipe = CreateNamedPipe(pipeName, PIPE_ACCESS_INBOUND | readMode,
|
||||||
PIPE_TYPE_BYTE | PIPE_WAIT, 1, size, size, 60 * 1000, securityAttributes);
|
PIPE_TYPE_BYTE | PIPE_WAIT, 1, size, size, 60 * 1000, securityAttributes);
|
||||||
|
|
||||||
if (!*outReadPipe)
|
if (*outReadPipe == INVALID_HANDLE_VALUE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
*outWritePipe = CreateFile(pipeName, GENERIC_WRITE, 0, securityAttributes, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | writeMode, NULL);
|
*outWritePipe = CreateFile(pipeName, GENERIC_WRITE, 0, securityAttributes, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | writeMode, NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user