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() void App::reloadConfig()
{ {
// reload config // reload config WIP
/*
m_self->m_options->parseConfig(m_self->m_options->configFile()); m_self->m_options->parseConfig(m_self->m_options->configFile());
Platform::release(); Platform::release();
@ -221,8 +222,7 @@ void App::reloadConfig()
Summary::print(); Summary::print();
Workers::start(m_self->m_options->affinity(), m_self->m_options->priority()); 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) 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) { } else if (controlCommand.getCommand() == ControlCommand::UPDATE_CONFIG) {
LOG_INFO("Command: UPDATE_CONFIG received -> Updating config"); LOG_INFO("Command: UPDATE_CONFIG received -> Updating config");
updateConfig(); updateConfig();
} else if (controlCommand.getCommand() == ControlCommand::RESTART) { } else if (controlCommand.getCommand() == ControlCommand::RELOAD) {
LOG_INFO("Command: RESTART received -> Restart"); LOG_INFO("Command: RELOAD received -> Reload");
App::restart(); App::reloadConfig();
} else { } else {
LOG_ERR("Command: GET_CONFIG received -> NOT IMPLEMENTED YET!"); LOG_ERR("Command: GET_CONFIG received -> NOT IMPLEMENTED YET!");
} }
@ -157,8 +157,8 @@ void CCClient::updateConfig()
clientConfigFile << buffer.GetString(); clientConfigFile << buffer.GetString();
clientConfigFile.close(); clientConfigFile.close();
LOG_INFO("Config update done. Restarting."); LOG_INFO("Config update done. Reload.");
App::restart(); App::reloadConfig();
} else { } else {
LOG_ERR("Not able to store client config to file %s.", m_self->m_options->configFile()); LOG_ERR("Not able to store client config to file %s.", m_self->m_options->configFile());
} }

View file

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

View file

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