[IPCHandler] Only run worker for the first instance
This commit is contained in:
parent
7a9bda58c2
commit
adedc4088f
@ -20,6 +20,7 @@ namespace Components
|
||||
void IPCHandler::SendWorker(std::string message, std::string data)
|
||||
{
|
||||
IPCHandler::InitChannels();
|
||||
if (!Singleton::IsFirstInstance()) return;
|
||||
|
||||
Proto::IPC::Command command;
|
||||
command.set_name(message);
|
||||
@ -50,11 +51,14 @@ namespace Components
|
||||
}
|
||||
|
||||
void IPCHandler::InitChannels()
|
||||
{
|
||||
if (Singleton::IsFirstInstance())
|
||||
{
|
||||
if (!IPCHandler::WorkerChannel)
|
||||
{
|
||||
IPCHandler::WorkerChannel.reset(new Utils::IPC::BidirectionalChannel("IW4x-Worker-Channel", !Worker::IsWorker()));
|
||||
}
|
||||
}
|
||||
|
||||
if (!IPCHandler::ClientChannel)
|
||||
{
|
||||
@ -64,6 +68,8 @@ namespace Components
|
||||
|
||||
void IPCHandler::StartWorker()
|
||||
{
|
||||
if (!Singleton::IsFirstInstance()) return;
|
||||
|
||||
STARTUPINFOA sInfo;
|
||||
PROCESS_INFORMATION pInfo;
|
||||
|
||||
@ -99,6 +105,7 @@ namespace Components
|
||||
void IPCHandler::HandleWorker()
|
||||
{
|
||||
IPCHandler::InitChannels();
|
||||
if (!Singleton::IsFirstInstance()) return;
|
||||
|
||||
std::string packet;
|
||||
if (IPCHandler::WorkerChannel->receive(&packet))
|
||||
|
Loading…
Reference in New Issue
Block a user