[*] NT IPCPipe: fix up renegotiation after termination
This commit is contained in:
parent
03f072f8d6
commit
d60176afb3
@ -110,35 +110,39 @@ namespace Aurora::IO::IPC
|
||||
|
||||
this->overlapped.hEvent = GetConnectHandle();
|
||||
|
||||
bool firstTime = AuExchange(bFirstTime, false);
|
||||
if (firstTime ||
|
||||
(WaitForSingleObject(this->overlapped.hEvent, 0) == WAIT_OBJECT_0 &&
|
||||
(GetOverlappedResult(this->serverHandle_, &this->overlapped, &idc, false))))
|
||||
if (AuExchange(bFirstTime, false) ||
|
||||
(WaitForSingleObject(this->overlapped.hEvent, 0) == WAIT_OBJECT_0))
|
||||
{
|
||||
ResetEvent(this->overlapped.hEvent);
|
||||
|
||||
if (ConnectNamedPipe(this->serverHandle_, &this->overlapped))
|
||||
{
|
||||
bFirstTime = true;
|
||||
this->bFirstTime = true;
|
||||
TryConnect();
|
||||
}
|
||||
else if (GetLastError() == ERROR_IO_PENDING)
|
||||
else
|
||||
{
|
||||
// No-op
|
||||
auto lastError = GetLastError();
|
||||
|
||||
if (lastError == ERROR_IO_PENDING)
|
||||
{
|
||||
// No-op
|
||||
}
|
||||
else if (lastError == ERROR_PIPE_CONNECTED)
|
||||
{
|
||||
SetEvent(this->overlapped.hEvent);
|
||||
}
|
||||
else if (lastError == ERROR_NO_DATA)
|
||||
{
|
||||
DisconnectNamedPipe(this->serverHandle_);
|
||||
this->bFirstTime = true;
|
||||
TryConnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
SysPushErrorIO("{}", lastError);
|
||||
}
|
||||
}
|
||||
else if (GetLastError() == ERROR_PIPE_CONNECTED)
|
||||
{
|
||||
SetEvent(this->overlapped.hEvent);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
if (WaitForSingleObject(this->overlapped.hEvent, 0) == WAIT_OBJECT_0)
|
||||
{
|
||||
ResetEvent(this->overlapped.hEvent);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user