Fixes in command handling

This commit is contained in:
Ben Gräf 2017-10-16 22:33:18 +02:00
parent 641bd27b77
commit 5c065a8e48
4 changed files with 10 additions and 14 deletions

View file

@ -206,7 +206,8 @@ void App::close()
void App::reloadConfig()
{
// reload config
// reload config WIP
/*
m_self->m_options->parseConfig(m_self->m_options->configFile());
Platform::release();
@ -221,8 +222,7 @@ void App::reloadConfig()
Summary::print();
Workers::start(m_self->m_options->affinity(), m_self->m_options->priority());
m_self->m_options
*/
}
void App::onSignal(uv_signal_t *handle, int signum)

View file

@ -123,9 +123,9 @@ void CCClient::publishClientStatusReport()
} else if (controlCommand.getCommand() == ControlCommand::UPDATE_CONFIG) {
LOG_INFO("Command: UPDATE_CONFIG received -> Updating config");
updateConfig();
} else if (controlCommand.getCommand() == ControlCommand::RESTART) {
LOG_INFO("Command: RESTART received -> Restart");
App::restart();
} else if (controlCommand.getCommand() == ControlCommand::RELOAD) {
LOG_INFO("Command: RELOAD received -> Reload");
App::reloadConfig();
} else {
LOG_ERR("Command: GET_CONFIG received -> NOT IMPLEMENTED YET!");
}
@ -157,8 +157,8 @@ void CCClient::updateConfig()
clientConfigFile << buffer.GetString();
clientConfigFile.close();
LOG_INFO("Config update done. Restarting.");
App::restart();
LOG_INFO("Config update done. Reload.");
App::reloadConfig();
} else {
LOG_ERR("Not able to store client config to file %s.", m_self->m_options->configFile());
}

View file

@ -36,7 +36,7 @@ public:
{
START,
STOP,
RESTART,
RELOAD,
UPDATE_CONFIG,
HALT
};

View file

@ -225,16 +225,12 @@ unsigned Service::setClientStatus(const std::string& clientId, const std::string
return MHD_HTTP_BAD_REQUEST;
}
if (m_clientCommand.find(clientId) != m_clientCommand.end()) {
m_clientCommand[clientId] = ControlCommand();
}
return getClientCommand(clientId, resp);
}
unsigned Service::getClientCommand(const std::string& clientId, std::string& resp)
{
if (m_clientCommand.find(clientId) != m_clientCommand.end()) {
if (m_clientCommand.find(clientId) == m_clientCommand.end()) {
m_clientCommand[clientId] = ControlCommand();
}