[IPCPipe] Correctly shutdown the pipe
This commit is contained in:
parent
d31c1c5bb6
commit
fff9046b72
@ -21,8 +21,7 @@ namespace Components
|
||||
// Not sure if that's the best way though
|
||||
Discovery::IsPerforming = false;
|
||||
Discovery::IsTerminating = false;
|
||||
Discovery::Thread = std::thread([] ()
|
||||
{
|
||||
Discovery::Thread = std::thread([]()
|
||||
{
|
||||
while (!Discovery::IsTerminating)
|
||||
{
|
||||
@ -45,7 +44,6 @@ namespace Components
|
||||
|
||||
std::this_thread::sleep_for(50ms);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Network::Handle("discovery", [] (Network::Address address, std::string data)
|
||||
|
@ -109,12 +109,16 @@ namespace Components
|
||||
|
||||
if (this->pipe && INVALID_HANDLE_VALUE != this->pipe)
|
||||
{
|
||||
CancelIoEx(this->pipe, nullptr);
|
||||
//DeleteFileA(this->pipeFile);
|
||||
|
||||
if (this->type == IPCTYPE_SERVER) DisconnectNamedPipe(this->pipe);
|
||||
|
||||
CloseHandle(this->pipe);
|
||||
Logger::Print("Disconnected from the pipe.\n");
|
||||
}
|
||||
|
||||
this->pipe = nullptr;
|
||||
this->threadAttached = false;
|
||||
|
||||
if (this->thread.joinable())
|
||||
@ -139,7 +143,6 @@ namespace Components
|
||||
}
|
||||
|
||||
void Pipe::ReceiveThread(Pipe* pipe)
|
||||
{
|
||||
{
|
||||
if (!pipe || pipe->type != IPCTYPE_SERVER || pipe->pipe == INVALID_HANDLE_VALUE || !pipe->pipe) return;
|
||||
|
||||
@ -177,7 +180,6 @@ namespace Components
|
||||
ZeroMemory(&pipe->packet, sizeof(pipe->packet));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
@ -237,7 +239,7 @@ namespace Components
|
||||
|
||||
void IPCPipe::preDestroy()
|
||||
{
|
||||
//IPCPipe::ServerPipe.destroy();
|
||||
//IPCPipe::ClientPipe.destroy();
|
||||
IPCPipe::ServerPipe.destroy();
|
||||
IPCPipe::ClientPipe.destroy();
|
||||
}
|
||||
}
|
||||
|
@ -159,8 +159,7 @@ namespace Components
|
||||
if (!Utils::IsWineEnvironment())
|
||||
{
|
||||
News::Terminate = false;
|
||||
News::Thread = std::thread([] ()
|
||||
{
|
||||
News::Thread = std::thread([]()
|
||||
{
|
||||
Localization::Set("MPUI_CHANGELOG_TEXT", Utils::Cache::GetFile("/iw4/changelog.txt"));
|
||||
|
||||
@ -184,7 +183,6 @@ namespace Components
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user