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