Added xmrigDaemon to control xmrigMiner

Fixed some issues in CCClient and CCServer
This commit is contained in:
Ben Gräf 2017-10-19 22:12:20 +02:00
parent 2b97e2f4ff
commit 3f39ca31fd
15 changed files with 86 additions and 83 deletions

View file

@ -116,23 +116,26 @@ void CCClient::publishClientStatusReport()
if (controlCommand.parseFromJsonString(responseBuffer)) {
if (controlCommand.getCommand() == ControlCommand::START) {
if (!Workers::isEnabled()) {
LOG_INFO("[CC-Client] Command: START received -> resume");
LOG_WARN("[CC-Client] Command: START received -> resume");
Workers::setEnabled(true);
}
} else if (controlCommand.getCommand() == ControlCommand::STOP) {
if (Workers::isEnabled()) {
LOG_INFO("[CC-Client] Command: STOP received -> pause");
LOG_WARN("[CC-Client] Command: STOP received -> pause");
Workers::setEnabled(false);
}
} else if (controlCommand.getCommand() == ControlCommand::UPDATE_CONFIG) {
LOG_WARN("[CC-Client] Command: UPDATE_CONFIG received -> update config");
updateConfig();
} else if (controlCommand.getCommand() == ControlCommand::RESTART) {
LOG_WARN("[CC-Client] Command: RESTART received -> restart");
App::restart();
} else if (controlCommand.getCommand() == ControlCommand::QUIT) {
// TODO
LOG_WARN("[CC-Client] Command: QUIT received -> quit");
App::quit();
}
} else {
LOG_ERR("[CC-Client] unknown command received from CC Server.");
LOG_ERR("[CC-Client] Unknown command received from CC Server.");
}
}
}
@ -162,13 +165,13 @@ void CCClient::updateConfig()
clientConfigFile << buffer.GetString();
clientConfigFile.close();
LOG_INFO("[CC-Client] config updated. restart.");
LOG_WARN("[CC-Client] Config updated. -> restart");
App::restart();
} else {
LOG_ERR("[CC-Client] not able to store client config to file %s.", m_self->m_options->configFile());
LOG_ERR("[CC-Client] Not able to store client config to file %s.", m_self->m_options->configFile());
}
} else{
LOG_ERR("[CC-Client] not able to store client config. received client config is broken!");
LOG_ERR("[CC-Client] Not able to store client config. received client config is broken!");
}
}
}

View file

@ -78,7 +78,6 @@ CCServer::~CCServer()
uv_tty_reset_mode();
delete m_httpd;
delete m_console;
}
int CCServer::start()

View file

@ -58,6 +58,7 @@ private:
Httpd* m_httpd;
Options* m_options;
uv_signal_t m_signal;
};

View file

@ -118,9 +118,9 @@ uint64_t ClientStatus::getSharesTotal() const
return m_sharesTotal;
}
void ClientStatus::setSharesTotal(uint64_t sharedTotal)
void ClientStatus::setSharesTotal(uint64_t sharesTotal)
{
m_sharesTotal = sharedTotal;
m_sharesTotal = sharesTotal;
}
uint64_t ClientStatus::getHashesTotal() const
@ -198,8 +198,8 @@ bool ClientStatus::parseFromJson(const rapidjson::Document& document)
m_avgTime = clientStatus["avg_time"].GetUint();
}
if (clientStatus.HasMember("shared_good")) {
m_sharesGood = clientStatus["shared_good"].GetUint64();
if (clientStatus.HasMember("shares_good")) {
m_sharesGood = clientStatus["shares_good"].GetUint64();
}
if (clientStatus.HasMember("shares_total")) {
@ -235,7 +235,7 @@ rapidjson::Value ClientStatus::toJson(rapidjson::MemoryPoolAllocator<rapidjson::
clientStatus.AddMember("hashrate_highest", m_hashrateHighest, allocator);
clientStatus.AddMember("avg_time", m_avgTime, allocator);
clientStatus.AddMember("shared_good", m_sharesGood, allocator);
clientStatus.AddMember("shares_good", m_sharesGood, allocator);
clientStatus.AddMember("shares_total", m_sharesTotal, allocator);
clientStatus.AddMember("hashes_total", m_hashesTotal, allocator);

View file

@ -1,32 +0,0 @@
/* XMRigCC
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2016-2017 XMRig <support@xmrig.com>
* Copyright 2017- BenDr0id <ben@graef.in>
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CCServer.h"
int main(int argc, char** argv) {
CCServer ccServer(argc, argv);
return ccServer.start();
}