#97 Ignore keepalive option with minergate and nicehash.com

This commit is contained in:
XMRig 2017-10-06 19:10:08 +03:00
parent af51513614
commit 914fdd5f0a
4 changed files with 25 additions and 8 deletions

View file

@ -261,6 +261,10 @@ Options::Options(int argc, char **argv) :
}
}
for (Url *url : m_pools) {
url->applyExceptions();
}
m_ready = true;
}

View file

@ -57,7 +57,7 @@ static inline double normalize(double d)
return 0.0;
}
return std::floor(d * 10.0) / 10.0;
return std::floor(d * 100.0) / 100.0;
}

View file

@ -24,6 +24,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "net/Url.h"
@ -87,12 +88,6 @@ Url::~Url()
}
bool Url::isNicehash() const
{
return isValid() && (m_nicehash || strstr(m_host, ".nicehash.com"));
}
bool Url::parse(const char *url)
{
const char *p = strstr(url, "://");
@ -144,6 +139,23 @@ bool Url::setUserpass(const char *userpass)
}
void Url::applyExceptions()
{
if (!isValid()) {
return;
}
if (strstr(m_host, ".nicehash.com")) {
m_keepAlive = false;
m_nicehash = true;
}
if (strstr(m_host, ".minergate.com")) {
m_keepAlive = false;
}
}
void Url::setPassword(const char *password)
{
if (!password) {

View file

@ -41,6 +41,7 @@ public:
~Url();
inline bool isKeepAlive() const { return m_keepAlive; }
inline bool isNicehash() const { return m_nicehash; }
inline bool isValid() const { return m_host && m_port > 0; }
inline const char *host() const { return m_host; }
inline const char *password() const { return m_password ? m_password : kDefaultPassword; }
@ -49,9 +50,9 @@ public:
inline void setKeepAlive(bool keepAlive) { m_keepAlive = keepAlive; }
inline void setNicehash(bool nicehash) { m_nicehash = nicehash; }
bool isNicehash() const;
bool parse(const char *url);
bool setUserpass(const char *userpass);
void applyExceptions();
void setPassword(const char *password);
void setUser(const char *user);