Merged features for # 1.6.3 (#114)
- Added shift+click function for multi row selection to Dashboard - Added -DBUILD_STATIC=ON/OFF option to CMake configuration to create fully static builds - Added current algo and list of supported_varaints to login message for future usage on proxy - Added support for latest Stellite (XTL) and Alloy (XAO) variants - Simplification of configuration, "force-pow-variant" and "cryptonight-lite-ipbc" parameters are now deprecated see [Coin Configuration](https://github.com/Bendr0id/xmrigCC/wiki/Coin-configurations) for guidance - Fixed leaks in transport shutdown
This commit is contained in:
parent
dc6bcacaed
commit
f54ce3c95c
25 changed files with 654 additions and 431 deletions
|
@ -71,10 +71,14 @@ public:
|
|||
{
|
||||
if (isConnected()) {
|
||||
LOG_DEBUG("[%s:%d] Disconnecting", getConnectedIp().c_str(), getConnectedPort());
|
||||
|
||||
boost::system::error_code ec;
|
||||
socket_.get().lowest_layer().shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec);
|
||||
socket_.get().lowest_layer().close();
|
||||
}
|
||||
|
||||
ioService_.stop();
|
||||
ioService_.reset();
|
||||
}
|
||||
|
||||
bool isConnected() const override
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include <uv.h>
|
||||
#include <Options.h>
|
||||
|
||||
#include "PowVariant.h"
|
||||
|
||||
#include "interfaces/IClientListener.h"
|
||||
#include "log/Log.h"
|
||||
#include "net/Client.h"
|
||||
|
@ -224,26 +226,34 @@ bool Client::parseJob(const rapidjson::Value ¶ms, int *code)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (params.HasMember("variant")) {
|
||||
int variantFromProxy = params["variant"].GetInt();
|
||||
PowVariant powVariant = Options::i()->powVariant();
|
||||
|
||||
switch (variantFromProxy) {
|
||||
case -1:
|
||||
job.setPowVersion(Options::POW_AUTODETECT);
|
||||
break;
|
||||
case 0:
|
||||
job.setPowVersion(Options::POW_V1);
|
||||
break;
|
||||
case 1:
|
||||
job.setPowVersion(Options::POW_V2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if (params.HasMember("algo")) {
|
||||
std::string algo = params["algo"].GetString();
|
||||
|
||||
if (algo.find("/") != std::string::npos) {
|
||||
powVariant = parseVariant(algo.substr(algo.find("/")+1));
|
||||
}
|
||||
} else {
|
||||
job.setPowVersion(Options::i()->forcePowVersion());
|
||||
}
|
||||
|
||||
if (params.HasMember("variant")) {
|
||||
const rapidjson::Value &variant = params["variant"];
|
||||
|
||||
PowVariant parsedVariant = powVariant;
|
||||
|
||||
if (variant.IsInt()) {
|
||||
parsedVariant = parseVariant(variant.GetInt());
|
||||
} else if (variant.IsString()) {
|
||||
parsedVariant = parseVariant(variant.GetString());
|
||||
}
|
||||
|
||||
if (parsedVariant != POW_AUTODETECT) {
|
||||
powVariant = parsedVariant;
|
||||
}
|
||||
}
|
||||
|
||||
job.setPowVariant(powVariant);
|
||||
|
||||
if (m_job != job) {
|
||||
m_jobs++;
|
||||
m_job = std::move(job);
|
||||
|
@ -350,6 +360,15 @@ void Client::login()
|
|||
params.AddMember("pass", rapidjson::StringRef(m_url.password()), allocator);
|
||||
params.AddMember("agent", rapidjson::StringRef(m_agent), allocator);
|
||||
|
||||
params.AddMember("algo", rapidjson::StringRef(Options::i()->algoShortName()), allocator);
|
||||
|
||||
rapidjson::Value supportedPowVariantsList(rapidjson::kArrayType);
|
||||
for (auto& supportedPowVariant : getSupportedPowVariants()) {
|
||||
supportedPowVariantsList.PushBack(rapidjson::StringRef(supportedPowVariant.c_str()), allocator);
|
||||
}
|
||||
|
||||
params.AddMember("supported-variants", supportedPowVariantsList, allocator);
|
||||
|
||||
doc.AddMember("params", params, allocator);
|
||||
|
||||
rapidjson::StringBuffer buffer(0, 512);
|
||||
|
|
|
@ -82,6 +82,10 @@ Connection::Ptr establishConnection(const ConnectionListener::Ptr& listener,
|
|||
}
|
||||
catch (...) {
|
||||
LOG_ERR("[%s:%d] Failed to establish connection: %s", host.c_str(), port, boost::current_exception_diagnostic_information().c_str());
|
||||
|
||||
if (connection) {
|
||||
connection->disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ Job::Job(int poolId, bool nicehash) :
|
|||
m_size(0),
|
||||
m_diff(0),
|
||||
m_target(0),
|
||||
m_powVersion(Options::POW_AUTODETECT)
|
||||
m_powVariant(PowVariant::POW_AUTODETECT)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -136,6 +136,21 @@ bool Job::setTarget(const char *target)
|
|||
return true;
|
||||
}
|
||||
|
||||
PowVariant Job::powVariant() const
|
||||
{
|
||||
if (m_powVariant == PowVariant::POW_AUTODETECT)
|
||||
{
|
||||
return (m_blob[0] > 6 ? PowVariant::POW_V1 : PowVariant::POW_V0);
|
||||
}
|
||||
else if (m_powVariant == PowVariant::POW_XTL && m_blob[0] < 4)
|
||||
{
|
||||
return POW_V1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_powVariant;
|
||||
}
|
||||
}
|
||||
|
||||
bool Job::fromHex(const char* in, unsigned int len, unsigned char* out)
|
||||
{
|
||||
|
@ -150,7 +165,6 @@ bool Job::fromHex(const char* in, unsigned int len, unsigned char* out)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Job::toHex(const unsigned char* in, unsigned int len, char* out)
|
||||
{
|
||||
for (unsigned int i = 0; i < len; i++) {
|
||||
|
@ -159,7 +173,6 @@ void Job::toHex(const unsigned char* in, unsigned int len, char* out)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool Job::operator==(const Job &other) const
|
||||
{
|
||||
return m_id == other.m_id && memcmp(m_blob, other.m_blob, sizeof(m_blob)) == 0;
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
|
||||
bool setBlob(const char *blob);
|
||||
bool setTarget(const char *target);
|
||||
PowVariant powVariant() const;
|
||||
|
||||
inline bool isNicehash() const { return m_nicehash; }
|
||||
inline bool isValid() const { return m_size > 0 && m_diff > 0; }
|
||||
|
@ -49,15 +50,13 @@ public:
|
|||
inline const uint32_t *nonce() const { return reinterpret_cast<const uint32_t*>(m_blob + 39); }
|
||||
inline const uint8_t *blob() const { return m_blob; }
|
||||
inline int poolId() const { return m_poolId; }
|
||||
inline int threadId() const { return m_threadId; }
|
||||
inline Options::PowVersion powVersion() const { return m_powVersion; }
|
||||
inline size_t size() const { return m_size; }
|
||||
inline uint32_t *nonce() { return reinterpret_cast<uint32_t*>(m_blob + 39); }
|
||||
inline uint32_t diff() const { return (uint32_t) m_diff; }
|
||||
inline uint64_t target() const { return m_target; }
|
||||
inline void setNicehash(bool nicehash) { m_nicehash = nicehash; }
|
||||
inline void setThreadId(int threadId) { m_threadId = threadId; }
|
||||
inline void setPowVersion(Options::PowVersion powVersion) { m_powVersion = powVersion; }
|
||||
inline void setPowVariant(PowVariant powVariant) { m_powVariant = powVariant; }
|
||||
|
||||
static bool fromHex(const char* in, unsigned int len, unsigned char* out);
|
||||
static inline uint32_t *nonce(uint8_t *blob) { return reinterpret_cast<uint32_t*>(blob + 39); }
|
||||
|
@ -77,7 +76,7 @@ private:
|
|||
size_t m_size;
|
||||
uint64_t m_diff;
|
||||
uint64_t m_target;
|
||||
Options::PowVersion m_powVersion;
|
||||
PowVariant m_powVariant;
|
||||
};
|
||||
|
||||
#endif /* __JOB_H__ */
|
||||
|
|
|
@ -170,12 +170,11 @@ void Network::onResultAccepted(Client *client, const SubmitResult &result, const
|
|||
void Network::setJob(Client *client, const Job &job)
|
||||
{
|
||||
if (m_options->colors()) {
|
||||
LOG_INFO("\x1B[01;35mnew job\x1B[0m from \x1B[01;37m%s:%d\x1B[0m with diff \x1B[01;37m%d\x1B[0m and PoW \x1B[01;37mv%d",
|
||||
client->host(), client->port(), job.diff(), job.powVersion());
|
||||
LOG_INFO("\x1B[01;35mnew job\x1B[0m from \x1B[01;37m%s:%d\x1B[0m with diff \x1B[01;37m%d\x1B[0m and PoW \x1B[01;37m%s",
|
||||
client->host(), client->port(), job.diff(), getPowVariantName(job.powVariant()).c_str());
|
||||
}
|
||||
else {
|
||||
LOG_INFO("new job from %s:%d with diff %d and PoW v%d",
|
||||
client->host(), client->port(), job.diff(), job.powVersion());
|
||||
LOG_INFO("new job from %s:%d with diff %d and PoW %s", client->host(), client->port(), job.diff(), getPowVariantName(job.powVariant()).c_str());
|
||||
}
|
||||
|
||||
m_state.diff = job.diff();
|
||||
|
|
|
@ -58,30 +58,18 @@ DonateStrategy::DonateStrategy(const char *agent, IStrategyListener *listener) :
|
|||
#ifndef XMRIG_NO_TLS
|
||||
if (Options::i()->algo() == Options::ALGO_CRYPTONIGHT_HEAVY) {
|
||||
url = new Url("donate2.graef.in", 8443, userId, nullptr, true, false, true);
|
||||
} else if (Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE_IPBC) {
|
||||
} else if (Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE) {
|
||||
url = new Url("donate2.graef.in", 1080, userId, nullptr, true, false, true);
|
||||
} else {
|
||||
if (Options::i()->forcePowVersion() == Options::POW_V1) {
|
||||
url = new Url("donate.graef.in", Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE ? 8080 : 8081, userId, nullptr, true, false, true);
|
||||
} else if (Options::i()->forcePowVersion() == Options::POW_V2) {
|
||||
url = new Url("donate2.graef.in", Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE ? 995 : 993, userId, nullptr, true, false, true);
|
||||
} else {
|
||||
url = new Url("donate2.graef.in", Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE ? 8081 : 443, userId, nullptr, true, false, true);
|
||||
}
|
||||
url = new Url("donate2.graef.in", 443, userId, nullptr, true, false, true);
|
||||
}
|
||||
#else
|
||||
if (Options::i()->algo() == Options::ALGO_CRYPTONIGHT_HEAVY) {
|
||||
url = new Url("donate.graef.in", 8443, userId, nullptr, false, false, true);
|
||||
} else if (Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE_IPBC) {
|
||||
} else if (Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE) {
|
||||
url = new Url("donate.graef.in", 1080, userId, nullptr, false, false, true);
|
||||
} else {
|
||||
if (Options::i()->forcePowVersion() == Options::POW_V1) {
|
||||
url = new Url("donate.graef.in", Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE ? 80 : 443, userId, nullptr, false, false, true);
|
||||
} else if (Options::i()->forcePowVersion() == Options::POW_V2) {
|
||||
url = new Url("donate.graef.in", Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE ? 995 : 993, userId, nullptr, false, false, true);
|
||||
} else {
|
||||
url = new Url("donate2.graef.in", Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE ? 8080 : 80, userId, nullptr, false, false, true);
|
||||
}
|
||||
url = new Url("donate2.graef.in", 80, userId, nullptr, false, false, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue