mirror of
https://github.com/xmrig/xmrig.git
synced 2025-03-12 09:37:35 +00:00
Automatically enable nicehash when use with upcoming xmrig-proxy 2.5.
This commit is contained in:
parent
69b8a4faf1
commit
37ac1aa62c
2 changed files with 28 additions and 1 deletions
|
@ -55,6 +55,7 @@ int64_t Client::m_sequence = 1;
|
|||
|
||||
Client::Client(int id, const char *agent, IClientListener *listener) :
|
||||
m_ipv6(false),
|
||||
m_nicehash(false),
|
||||
m_quiet(false),
|
||||
m_agent(agent),
|
||||
m_listener(listener),
|
||||
|
@ -220,7 +221,7 @@ bool Client::parseJob(const rapidjson::Value ¶ms, int *code)
|
|||
return false;
|
||||
}
|
||||
|
||||
Job job(m_id, m_url.isNicehash(), m_url.isMonero());
|
||||
Job job(m_id, m_nicehash, m_url.isMonero());
|
||||
if (!job.setId(params["job_id"].GetString())) {
|
||||
*code = 3;
|
||||
return false;
|
||||
|
@ -257,6 +258,12 @@ bool Client::parseLogin(const rapidjson::Value &result, int *code)
|
|||
return false;
|
||||
}
|
||||
|
||||
m_nicehash = m_url.isNicehash();
|
||||
|
||||
if (result.HasMember("extensions")) {
|
||||
parseExtensions(result["extensions"]);
|
||||
}
|
||||
|
||||
return parseJob(result["job"], code);
|
||||
}
|
||||
|
||||
|
@ -419,6 +426,24 @@ void Client::parse(char *line, size_t len)
|
|||
}
|
||||
|
||||
|
||||
void Client::parseExtensions(const rapidjson::Value &value)
|
||||
{
|
||||
if (!value.IsArray()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const rapidjson::Value &ext : value.GetArray()) {
|
||||
if (!ext.IsString()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp(ext.GetString(), "nicehash") == 0) {
|
||||
m_nicehash = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Client::parseNotification(const char *method, const rapidjson::Value ¶ms, const rapidjson::Value &error)
|
||||
{
|
||||
if (error.IsObject()) {
|
||||
|
|
|
@ -86,6 +86,7 @@ private:
|
|||
void connect(sockaddr *addr);
|
||||
void login();
|
||||
void parse(char *line, size_t len);
|
||||
void parseExtensions(const rapidjson::Value &value);
|
||||
void parseNotification(const char *method, const rapidjson::Value ¶ms, const rapidjson::Value &error);
|
||||
void parseResponse(int64_t id, const rapidjson::Value &result, const rapidjson::Value &error);
|
||||
void ping();
|
||||
|
@ -103,6 +104,7 @@ private:
|
|||
|
||||
addrinfo m_hints;
|
||||
bool m_ipv6;
|
||||
bool m_nicehash;
|
||||
bool m_quiet;
|
||||
char m_buf[2048];
|
||||
char m_ip[46];
|
||||
|
|
Loading…
Reference in a new issue