mirror of
https://github.com/xmrig/xmrig-proxy.git
synced 2026-02-09 02:59:17 +08:00
Added nicehash extension.
This commit is contained in:
@@ -393,6 +393,11 @@ void Client::parse(char *line, size_t len)
|
||||
|
||||
LOG_DEBUG("[%s:%u] received (%d bytes): \"%s\"", m_url.host(), m_url.port(), len, line);
|
||||
|
||||
if (len < 32 || line[0] != '{') {
|
||||
LOG_ERR("[%s:%u] JSON decode failed", m_url.host(), m_url.port());
|
||||
return;
|
||||
}
|
||||
|
||||
rapidjson::Document doc;
|
||||
if (doc.ParseInsitu(line).HasParseError()) {
|
||||
if (!m_quiet) {
|
||||
|
||||
@@ -227,6 +227,11 @@ Url &Url::operator=(const Url *other)
|
||||
setPassword(other->m_password);
|
||||
setUser(other->m_user);
|
||||
|
||||
if (m_url) {
|
||||
delete [] m_url;
|
||||
m_url = nullptr;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -126,11 +126,13 @@ void Miner::setJob(Job &job)
|
||||
int size = 0;
|
||||
if (m_state == WaitReadyState) {
|
||||
setState(ReadyState);
|
||||
size = snprintf(m_sendBuf, sizeof(m_sendBuf), "{\"id\":%" PRId64 ",\"jsonrpc\":\"2.0\",\"result\":{\"id\":\"%s\",\"job\":{\"blob\":\"%s\",\"job_id\":\"%s%02hhx0\",\"target\":\"%s\"},\"status\":\"OK\"}}\n",
|
||||
size = snprintf(m_sendBuf, sizeof(m_sendBuf),
|
||||
"{\"id\":%" PRId64 ",\"jsonrpc\":\"2.0\",\"result\":{\"id\":\"%s\",\"job\":{\"blob\":\"%s\",\"job_id\":\"%s%02hhx0\",\"target\":\"%s\"},\"extensions\":[\"nicehash\"],\"status\":\"OK\"}}\n",
|
||||
m_loginId, m_rpcId, job.rawBlob(), job.id().data(), m_fixedByte, customDiff ? target : job.rawTarget());
|
||||
}
|
||||
else {
|
||||
size = snprintf(m_sendBuf, sizeof(m_sendBuf), "{\"jsonrpc\":\"2.0\",\"method\":\"job\",\"params\":{\"blob\":\"%s\",\"job_id\":\"%s%02hhx0\",\"target\":\"%s\"}}\n",
|
||||
size = snprintf(m_sendBuf, sizeof(m_sendBuf),
|
||||
"{\"jsonrpc\":\"2.0\",\"method\":\"job\",\"params\":{\"blob\":\"%s\",\"job_id\":\"%s%02hhx0\",\"target\":\"%s\"}}\n",
|
||||
job.rawBlob(), job.id().data(), m_fixedByte, customDiff ? target : job.rawTarget());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user