mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-09-11 21:44:58 -04:00
let's see how many typos i have
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
#include "sharedFoundation/Clock.h"
|
||||
#include "sharedMessageDispatch/Transceiver.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
CentralConnection::CentralConnection(TaskConnection * c, const std::string & n) :
|
||||
@@ -84,30 +86,37 @@ void CentralConnection::receive(const Archive::ByteStream & message)
|
||||
{
|
||||
Archive::ReadIterator r(message);
|
||||
GameNetworkMessage m(r);
|
||||
|
||||
r = message.begin();
|
||||
if(m.isType("TaskSpawnProcess"))
|
||||
{
|
||||
TaskSpawnProcess s(r);
|
||||
IGNORE_RETURN(TaskManager::startServer(s.getProcessName(), s.getOptions(), s.getTargetHostAddress(), s.getSpawnDelay()));
|
||||
}
|
||||
else if(m.isType("PreloadFinishedMessage"))
|
||||
{
|
||||
PreloadFinishedMessage m(r);
|
||||
if (m.getFinished())
|
||||
TaskManager::onPreloadFinished();
|
||||
}
|
||||
else if(m.isType("ConGenericMessage"))
|
||||
{
|
||||
ConGenericMessage taskConsoleCommand(r);
|
||||
|
||||
const uint32 messageType = m.getType();
|
||||
|
||||
static std::string command = taskConsoleCommand.getMsg();
|
||||
while(command.rfind(' ') != command.npos || command.rfind('\n') != command.npos || command.rfind('\r') != command.npos)
|
||||
switch (messageType) {
|
||||
case constcrc("TaskSpawnProcess") :
|
||||
{
|
||||
command = command.substr(0, command.length() - 1);
|
||||
TaskSpawnProcess s(r);
|
||||
IGNORE_RETURN(TaskManager::startServer(s.getProcessName(), s.getOptions(), s.getTargetHostAddress(), s.getSpawnDelay()));
|
||||
break;
|
||||
}
|
||||
case constcrc("PreloadFinishedMessage") :
|
||||
{
|
||||
PreloadFinishedMessage m(r);
|
||||
if (m.getFinished())
|
||||
TaskManager::onPreloadFinished();
|
||||
break;
|
||||
}
|
||||
case constcrc("ConGenericMessage") :
|
||||
{
|
||||
ConGenericMessage taskConsoleCommand(r);
|
||||
|
||||
TaskManager::executeCommand(command);
|
||||
static std::string command = taskConsoleCommand.getMsg();
|
||||
while(command.rfind(' ') != command.npos || command.rfind('\n') != command.npos || command.rfind('\r') != command.npos)
|
||||
{
|
||||
command = command.substr(0, command.length() - 1);
|
||||
}
|
||||
|
||||
TaskManager::executeCommand(command);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "serverNetworkMessages/GameTaskManagerMessages.h"
|
||||
#include "serverNetworkMessages/TaskSpawnProcess.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
DatabaseConnection::DatabaseConnection() :
|
||||
@@ -42,17 +44,23 @@ void DatabaseConnection::receive(const Archive::ByteStream & message)
|
||||
{
|
||||
Archive::ReadIterator r(message);
|
||||
GameNetworkMessage m(r);
|
||||
|
||||
r = message.begin();
|
||||
if(m.isType("TaskSpawnProcess"))
|
||||
{
|
||||
TaskSpawnProcess s(r);
|
||||
IGNORE_RETURN(TaskManager::startServer(s.getProcessName(), s.getOptions(), s.getTargetHostAddress(), s.getSpawnDelay()));
|
||||
}
|
||||
else if(m.isType("ServerIdleMessage"))
|
||||
{
|
||||
ServerIdleMessage msg(r);
|
||||
TaskManager::onDatabaseIdle(msg.getIsIdle());
|
||||
|
||||
const uint32 messageType = m.getType();
|
||||
|
||||
switch(messageType) {
|
||||
case constcrc("TaskSpawnProcess") :
|
||||
{
|
||||
TaskSpawnProcess s(r);
|
||||
IGNORE_RETURN(TaskManager::startServer(s.getProcessName(), s.getOptions(), s.getTargetHostAddress(), s.getSpawnDelay()));
|
||||
break;
|
||||
}
|
||||
case constcrc("ServerIdleMessage") :
|
||||
{
|
||||
ServerIdleMessage msg(r);
|
||||
TaskManager::onDatabaseIdle(msg.getIsIdle());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "TaskConnection.h"
|
||||
#include "TaskManager.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
namespace ManagerConnectionNamespace
|
||||
@@ -94,115 +96,126 @@ void ManagerConnection::onReceive(const Archive::ByteStream & message)
|
||||
{
|
||||
Archive::ReadIterator r(message);
|
||||
GameNetworkMessage m(r);
|
||||
|
||||
r = message.begin();
|
||||
if (m.isType("SystemTimeCheck"))
|
||||
{
|
||||
long const currentTime = static_cast<long>(::time(nullptr));
|
||||
GenericValueTypeMessage<std::pair<std::string, long > > msg(r);
|
||||
|
||||
if (TaskManager::getNodeLabel() == "node0")
|
||||
|
||||
const uint32 messageType = m.getType();
|
||||
|
||||
switch(messageType) {
|
||||
case constcrc("SystemTimeCheck") :
|
||||
{
|
||||
if ((std::max(currentTime, msg.getValue().second) - std::min(currentTime, msg.getValue().second)) > ConfigTaskManager::getMaximumClockDriftToleranceSeconds())
|
||||
long const currentTime = static_cast<long>(::time(nullptr));
|
||||
GenericValueTypeMessage<std::pair<std::string, long > > msg(r);
|
||||
|
||||
if (TaskManager::getNodeLabel() == "node0")
|
||||
{
|
||||
LOG("CustomerService", ("system_clock_mismatch:System clock mismatch (%d seconds) by more than %d seconds: master TaskManager epoch (%ld), remote TaskManager %s (%s) epoch (%ld)", (std::max(currentTime, msg.getValue().second) - std::min(currentTime, msg.getValue().second)), ConfigTaskManager::getMaximumClockDriftToleranceSeconds(), currentTime, msg.getValue().first.c_str(), getRemoteAddress().c_str(), msg.getValue().second));
|
||||
|
||||
// tell CentralServer about the system clock mismatch so it can report an alert to SOEMon
|
||||
GenericValueTypeMessage<std::string> systemTimeMismatchMessage("SystemTimeMismatchNotification",
|
||||
FormattedString<1024>().sprintf("%s: %s (%s) is off by %ld seconds", CalendarTime::convertEpochToTimeStringLocal(static_cast<time_t>(currentTime)).c_str(), msg.getValue().first.c_str(), getRemoteAddress().c_str(), (std::max(currentTime, msg.getValue().second) - std::min(currentTime, msg.getValue().second))));
|
||||
TaskManager::sendToCentralServer(systemTimeMismatchMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m.isType("TaskConnectionIdMessage"))
|
||||
{
|
||||
static long const clockDriftFatalTimePeriod = static_cast<long>(TaskManager::getStartTime()) + ConfigTaskManager::getClockDriftFatalIntervalSeconds();
|
||||
long const currentTime = static_cast<long>(::time(nullptr));
|
||||
TaskConnectionIdMessage t(r);
|
||||
WARNING_STRICT_FATAL(t.getServerType() != TaskConnectionIdMessage::TaskManager,
|
||||
("ManagerConnection received wrong type identifier"));
|
||||
WARNING_STRICT_FATAL(m_nodeLabel, ("Received new taskconnectionIdMessage with an already named connection"));
|
||||
|
||||
FATAL((ConfigTaskManager::getVerifyClusterName() && (TaskManager::getNodeLabel() == "node0") && (t.getServerType() == TaskConnectionIdMessage::TaskManager) && (t.getClusterName() != std::string(ConfigTaskManager::getClusterName()))), ("Remote TaskManager %s (%s) reported cluster name (%s) that is different from my cluster name (%s)", t.getCommandLine().c_str(), getRemoteAddress().c_str(), t.getClusterName().c_str(), ConfigTaskManager::getClusterName()));
|
||||
|
||||
// don't allow cluster to start if the system clock across the boxes are out of sync
|
||||
bool remoteSystemClockInSync = true;
|
||||
if (TaskManager::getNodeLabel() == "node0")
|
||||
{
|
||||
if ((std::max(currentTime, t.getCurrentEpochTime()) - std::min(currentTime, t.getCurrentEpochTime())) > ConfigTaskManager::getMaximumClockDriftToleranceSeconds())
|
||||
{
|
||||
remoteSystemClockInSync = false;
|
||||
|
||||
// don't bring down the cluster if we lost a box and when the box is
|
||||
// restarted, its system clock is out of sync; just ignore that
|
||||
// TaskManager, and send it a message to terminate itself
|
||||
if (currentTime <= clockDriftFatalTimePeriod)
|
||||
if ((std::max(currentTime, msg.getValue().second) - std::min(currentTime, msg.getValue().second)) > ConfigTaskManager::getMaximumClockDriftToleranceSeconds())
|
||||
{
|
||||
FATAL(true, ("System clock mismatch (%d seconds) by more than %d seconds: master TaskManager epoch (%ld), remote TaskManager %s (%s) epoch (%ld)", (std::max(currentTime, t.getCurrentEpochTime()) - std::min(currentTime, t.getCurrentEpochTime())), ConfigTaskManager::getMaximumClockDriftToleranceSeconds(), currentTime, t.getCommandLine().c_str(), getRemoteAddress().c_str(), t.getCurrentEpochTime()));
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG("CustomerService", ("system_clock_mismatch:System clock mismatch (%d seconds) by more than %d seconds: master TaskManager epoch (%ld), remote TaskManager %s (%s) epoch (%ld). Telling remote TaskManager to terminate.", (std::max(currentTime, t.getCurrentEpochTime()) - std::min(currentTime, t.getCurrentEpochTime())), ConfigTaskManager::getMaximumClockDriftToleranceSeconds(), currentTime, t.getCommandLine().c_str(), getRemoteAddress().c_str(), t.getCurrentEpochTime()));
|
||||
LOG("CustomerService", ("system_clock_mismatch:System clock mismatch (%d seconds) by more than %d seconds: master TaskManager epoch (%ld), remote TaskManager %s (%s) epoch (%ld)", (std::max(currentTime, msg.getValue().second) - std::min(currentTime, msg.getValue().second)), ConfigTaskManager::getMaximumClockDriftToleranceSeconds(), currentTime, msg.getValue().first.c_str(), getRemoteAddress().c_str(), msg.getValue().second));
|
||||
|
||||
GenericValueTypeMessage<std::pair<std::string, std::pair<long, long> > > systemTimeMismatchMessage("SystemTimeMismatchMessage", std::make_pair(TaskManager::getNodeLabel(), std::make_pair(static_cast<long>(currentTime), t.getCurrentEpochTime())));
|
||||
send(systemTimeMismatchMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (remoteSystemClockInSync)
|
||||
{
|
||||
m_nodeLabel = new std::string(t.getCommandLine());
|
||||
Locator::opened(*m_nodeLabel, this);
|
||||
TaskManager::resendUnacknowledgedSpawnRequests(this, *m_nodeLabel);
|
||||
}
|
||||
}
|
||||
else if (m.isType("SystemTimeMismatchMessage"))
|
||||
{
|
||||
GenericValueTypeMessage<std::pair<std::string, std::pair<long, long> > > msg(r);
|
||||
FATAL((msg.getValue().first == "node0"), ("System clock mismatch (%d seconds) by more than %d seconds: master TaskManager epoch (%ld), self epoch (%ld)", (std::max(msg.getValue().second.first, msg.getValue().second.second) - std::min(msg.getValue().second.first, msg.getValue().second.second)), ConfigTaskManager::getMaximumClockDriftToleranceSeconds(), msg.getValue().second.first, msg.getValue().second.second));
|
||||
}
|
||||
else if(m.isType("TaskSpawnProcess"))
|
||||
{
|
||||
TaskSpawnProcess s(r);
|
||||
if (TaskManager::startServer(s.getProcessName(), s.getOptions(), s.getTargetHostAddress(), s.getSpawnDelay()) == 0)
|
||||
{
|
||||
DEBUG_REPORT_LOG(true, ("Failed to spawn %s on this node\n", s.getProcessName().c_str()));
|
||||
//send fail message back
|
||||
}
|
||||
else
|
||||
{
|
||||
TaskSpawnProcessAck ack(s.getTransactionId());
|
||||
send(ack);
|
||||
}
|
||||
}
|
||||
else if(m.isType("TaskUtilization"))
|
||||
{
|
||||
TaskUtilization util(r);
|
||||
switch(util.getUtilType())
|
||||
{
|
||||
case TaskUtilization::SYSTEM_AVG:
|
||||
{
|
||||
if (m_nodeLabel)
|
||||
{
|
||||
m_remoteUtilAvg = util.getUtilAmount();
|
||||
Locator::updateServerLoad(*m_nodeLabel, m_remoteUtilAvg);
|
||||
// tell CentralServer about the system clock mismatch so it can report an alert to SOEMon
|
||||
GenericValueTypeMessage<std::string> systemTimeMismatchMessage("SystemTimeMismatchNotification",
|
||||
FormattedString<1024>().sprintf("%s: %s (%s) is off by %ld seconds", CalendarTime::convertEpochToTimeStringLocal(static_cast<time_t>(currentTime)).c_str(), msg.getValue().first.c_str(), getRemoteAddress().c_str(), (std::max(currentTime, msg.getValue().second) - std::min(currentTime, msg.getValue().second))));
|
||||
TaskManager::sendToCentralServer(systemTimeMismatchMessage);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
case constcrc("TaskConnectionIdMessage") :
|
||||
{
|
||||
static long const clockDriftFatalTimePeriod = static_cast<long>(TaskManager::getStartTime()) + ConfigTaskManager::getClockDriftFatalIntervalSeconds();
|
||||
long const currentTime = static_cast<long>(::time(nullptr));
|
||||
TaskConnectionIdMessage t(r);
|
||||
WARNING_STRICT_FATAL(t.getServerType() != TaskConnectionIdMessage::TaskManager,
|
||||
("ManagerConnection received wrong type identifier"));
|
||||
WARNING_STRICT_FATAL(m_nodeLabel, ("Received new taskconnectionIdMessage with an already named connection"));
|
||||
|
||||
FATAL((ConfigTaskManager::getVerifyClusterName() && (TaskManager::getNodeLabel() == "node0") && (t.getServerType() == TaskConnectionIdMessage::TaskManager) && (t.getClusterName() != std::string(ConfigTaskManager::getClusterName()))), ("Remote TaskManager %s (%s) reported cluster name (%s) that is different from my cluster name (%s)", t.getCommandLine().c_str(), getRemoteAddress().c_str(), t.getClusterName().c_str(), ConfigTaskManager::getClusterName()));
|
||||
|
||||
// don't allow cluster to start if the system clock across the boxes are out of sync
|
||||
bool remoteSystemClockInSync = true;
|
||||
if (TaskManager::getNodeLabel() == "node0")
|
||||
{
|
||||
if ((std::max(currentTime, t.getCurrentEpochTime()) - std::min(currentTime, t.getCurrentEpochTime())) > ConfigTaskManager::getMaximumClockDriftToleranceSeconds())
|
||||
{
|
||||
remoteSystemClockInSync = false;
|
||||
|
||||
// don't bring down the cluster if we lost a box and when the box is
|
||||
// restarted, its system clock is out of sync; just ignore that
|
||||
// TaskManager, and send it a message to terminate itself
|
||||
if (currentTime <= clockDriftFatalTimePeriod)
|
||||
{
|
||||
FATAL(true, ("System clock mismatch (%d seconds) by more than %d seconds: master TaskManager epoch (%ld), remote TaskManager %s (%s) epoch (%ld)", (std::max(currentTime, t.getCurrentEpochTime()) - std::min(currentTime, t.getCurrentEpochTime())), ConfigTaskManager::getMaximumClockDriftToleranceSeconds(), currentTime, t.getCommandLine().c_str(), getRemoteAddress().c_str(), t.getCurrentEpochTime()));
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG("CustomerService", ("system_clock_mismatch:System clock mismatch (%d seconds) by more than %d seconds: master TaskManager epoch (%ld), remote TaskManager %s (%s) epoch (%ld). Telling remote TaskManager to terminate.", (std::max(currentTime, t.getCurrentEpochTime()) - std::min(currentTime, t.getCurrentEpochTime())), ConfigTaskManager::getMaximumClockDriftToleranceSeconds(), currentTime, t.getCommandLine().c_str(), getRemoteAddress().c_str(), t.getCurrentEpochTime()));
|
||||
|
||||
GenericValueTypeMessage<std::pair<std::string, std::pair<long, long> > > systemTimeMismatchMessage("SystemTimeMismatchMessage", std::make_pair(TaskManager::getNodeLabel(), std::make_pair(static_cast<long>(currentTime), t.getCurrentEpochTime())));
|
||||
send(systemTimeMismatchMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (remoteSystemClockInSync)
|
||||
{
|
||||
m_nodeLabel = new std::string(t.getCommandLine());
|
||||
Locator::opened(*m_nodeLabel, this);
|
||||
TaskManager::resendUnacknowledgedSpawnRequests(this, *m_nodeLabel);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case constcrc("SystemTimeMismatchMessage") :
|
||||
{
|
||||
GenericValueTypeMessage<std::pair<std::string, std::pair<long, long> > > msg(r);
|
||||
FATAL((msg.getValue().first == "node0"), ("System clock mismatch (%d seconds) by more than %d seconds: master TaskManager epoch (%ld), self epoch (%ld)", (std::max(msg.getValue().second.first, msg.getValue().second.second) - std::min(msg.getValue().second.first, msg.getValue().second.second)), ConfigTaskManager::getMaximumClockDriftToleranceSeconds(), msg.getValue().second.first, msg.getValue().second.second));
|
||||
break;
|
||||
}
|
||||
case constcrc("TaskSpawnProcess") :
|
||||
{
|
||||
TaskSpawnProcess s(r);
|
||||
if (TaskManager::startServer(s.getProcessName(), s.getOptions(), s.getTargetHostAddress(), s.getSpawnDelay()) == 0)
|
||||
{
|
||||
DEBUG_REPORT_LOG(true, ("Failed to spawn %s on this node\n", s.getProcessName().c_str()));
|
||||
//send fail message back
|
||||
}
|
||||
else
|
||||
{
|
||||
TaskSpawnProcessAck ack(s.getTransactionId());
|
||||
send(ack);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case constcrc("TaskUtilization") :
|
||||
{
|
||||
TaskUtilization util(r);
|
||||
switch(util.getUtilType())
|
||||
{
|
||||
case TaskUtilization::SYSTEM_AVG:
|
||||
{
|
||||
if (m_nodeLabel)
|
||||
{
|
||||
m_remoteUtilAvg = util.getUtilAmount();
|
||||
Locator::updateServerLoad(*m_nodeLabel, m_remoteUtilAvg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case constcrc("TaskProcessDiedMessage") :
|
||||
{
|
||||
TaskProcessDiedMessage died(r);
|
||||
TaskManager::sendToCentralServer(died);
|
||||
break;
|
||||
}
|
||||
case constcrc("TaskSpawnProcessAck") :
|
||||
{
|
||||
TaskSpawnProcessAck ack(r);
|
||||
TaskManager::removePendingSpawnProcessAck(ack.getTransactionId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(m.isType("TaskProcessDiedMessage"))
|
||||
{
|
||||
TaskProcessDiedMessage died(r);
|
||||
TaskManager::sendToCentralServer(died);
|
||||
}
|
||||
else if(m.isType("TaskSpawnProcessAck"))
|
||||
{
|
||||
TaskSpawnProcessAck ack(r);
|
||||
TaskManager::removePendingSpawnProcessAck(ack.getTransactionId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "serverNetworkMessages/TaskKillProcess.h"
|
||||
#include "sharedNetwork/NetworkSetupData.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
TaskConnection::TaskConnection(const std::string & a, const unsigned short p) :
|
||||
@@ -94,70 +96,79 @@ void TaskConnection::onReceive(const Archive::ByteStream & message)
|
||||
|
||||
Archive::ReadIterator r(message);
|
||||
GameNetworkMessage m(r);
|
||||
if(m.isType("TaskConnectionIdMessage"))
|
||||
{
|
||||
r = message.begin();
|
||||
TaskConnectionIdMessage t(r);
|
||||
|
||||
FATAL((ConfigTaskManager::getVerifyClusterName() && (TaskManager::getNodeLabel() == "node0") && (t.getServerType() == TaskConnectionIdMessage::TaskManager) && (t.getClusterName() != std::string(ConfigTaskManager::getClusterName()))), ("Remote TaskManager %s (%s) reported cluster name (%s) that is different from my cluster name (%s)", t.getCommandLine().c_str(), getRemoteAddress().c_str(), t.getClusterName().c_str(), ConfigTaskManager::getClusterName()));
|
||||
|
||||
Identified i = {this, t.getServerType() };
|
||||
identified.emitMessage(i);
|
||||
|
||||
switch(i.id)
|
||||
|
||||
const uint32 messageType = m.getType();
|
||||
|
||||
switch(messageType) {
|
||||
case constcrc("TaskConnectionIdMessage") :
|
||||
{
|
||||
case TaskConnectionIdMessage::Central:
|
||||
{
|
||||
REPORT_LOG(true, ("New Central Server connection active\n"));
|
||||
handler = new CentralConnection(this, t.getCommandLine());
|
||||
TaskManager::setCentralConnection(this);
|
||||
}
|
||||
break;
|
||||
case TaskConnectionIdMessage::Game:
|
||||
{
|
||||
REPORT_LOG(true, ("New Game Server connection active\n"));
|
||||
handler = new GameConnection(this);
|
||||
}
|
||||
break;
|
||||
case TaskConnectionIdMessage::Database:
|
||||
{
|
||||
REPORT_LOG(true, ("New Database Server connection active\n"));
|
||||
handler = new DatabaseConnection();
|
||||
}
|
||||
break;
|
||||
case TaskConnectionIdMessage::Metrics:
|
||||
{
|
||||
REPORT_LOG(true, ("New Metrics Server connection active\n"));
|
||||
handler = new MetricsServerConnection(this, t.getCommandLine());
|
||||
}
|
||||
break;
|
||||
case TaskConnectionIdMessage::Planet:
|
||||
{
|
||||
REPORT_LOG(true, ("New Planet Server connection active\n"));
|
||||
handler = new PlanetConnection(this);
|
||||
}
|
||||
break;
|
||||
r = message.begin();
|
||||
TaskConnectionIdMessage t(r);
|
||||
|
||||
default:
|
||||
WARNING_STRICT_FATAL(true, ("Unknown id (%d) received on task connection", i.id));
|
||||
FATAL((ConfigTaskManager::getVerifyClusterName() && (TaskManager::getNodeLabel() == "node0") && (t.getServerType() == TaskConnectionIdMessage::TaskManager) && (t.getClusterName() != std::string(ConfigTaskManager::getClusterName()))), ("Remote TaskManager %s (%s) reported cluster name (%s) that is different from my cluster name (%s)", t.getCommandLine().c_str(), getRemoteAddress().c_str(), t.getClusterName().c_str(), ConfigTaskManager::getClusterName()));
|
||||
|
||||
Identified i = {this, t.getServerType() };
|
||||
identified.emitMessage(i);
|
||||
|
||||
switch(i.id)
|
||||
{
|
||||
case TaskConnectionIdMessage::Central:
|
||||
{
|
||||
REPORT_LOG(true, ("New Central Server connection active\n"));
|
||||
handler = new CentralConnection(this, t.getCommandLine());
|
||||
TaskManager::setCentralConnection(this);
|
||||
}
|
||||
break;
|
||||
case TaskConnectionIdMessage::Game:
|
||||
{
|
||||
REPORT_LOG(true, ("New Game Server connection active\n"));
|
||||
handler = new GameConnection(this);
|
||||
}
|
||||
break;
|
||||
case TaskConnectionIdMessage::Database:
|
||||
{
|
||||
REPORT_LOG(true, ("New Database Server connection active\n"));
|
||||
handler = new DatabaseConnection();
|
||||
}
|
||||
break;
|
||||
case TaskConnectionIdMessage::Metrics:
|
||||
{
|
||||
REPORT_LOG(true, ("New Metrics Server connection active\n"));
|
||||
handler = new MetricsServerConnection(this, t.getCommandLine());
|
||||
}
|
||||
break;
|
||||
case TaskConnectionIdMessage::Planet:
|
||||
{
|
||||
REPORT_LOG(true, ("New Planet Server connection active\n"));
|
||||
handler = new PlanetConnection(this);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
WARNING_STRICT_FATAL(true, ("Unknown id (%d) received on task connection", i.id));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case constcrc("ExcommunicateGameServerMessage") :
|
||||
{
|
||||
r = message.begin();
|
||||
ExcommunicateGameServerMessage ex(r);
|
||||
TaskKillProcess k(ex.getHostName(), ex.getProcessId(), true);
|
||||
TaskManager::killProcess(k);
|
||||
|
||||
// broadcast to other task managers
|
||||
Locator::sendToAllTaskManagers(k);
|
||||
|
||||
break;
|
||||
}
|
||||
case constcrc("TaskKillProcess") :
|
||||
{
|
||||
r = message.begin();
|
||||
TaskKillProcess k(r);
|
||||
TaskManager::killProcess(k);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(m.isType("ExcommunicateGameServerMessage"))
|
||||
{
|
||||
r = message.begin();
|
||||
ExcommunicateGameServerMessage ex(r);
|
||||
TaskKillProcess k(ex.getHostName(), ex.getProcessId(), true);
|
||||
TaskManager::killProcess(k);
|
||||
|
||||
// broadcast to other task managers
|
||||
Locator::sendToAllTaskManagers(k);
|
||||
}
|
||||
else if(m.isType("TaskKillProcess"))
|
||||
{
|
||||
r = message.begin();
|
||||
TaskKillProcess k(r);
|
||||
TaskManager::killProcess(k);
|
||||
}
|
||||
|
||||
msg.message = &message;
|
||||
|
||||
Reference in New Issue
Block a user