Sync changes.

This commit is contained in:
XMRig 2018-11-20 07:24:14 +07:00
parent 9f6f599d78
commit 2a2712ab90
12 changed files with 114 additions and 33 deletions

View file

@ -212,6 +212,10 @@ const char *Client::tlsVersion() const
int64_t Client::submit(const JobResult &result)
{
if (result.clientId != m_rpcId) {
return -1;
}
using namespace rapidjson;
# ifdef XMRIG_PROXY_PROJECT
@ -355,6 +359,8 @@ bool Client::parseJob(const rapidjson::Value &params, int *code)
return false;
}
m_job.setClientId(m_rpcId);
if (m_job != job) {
m_jobs++;
m_job = std::move(job);

View file

@ -21,8 +21,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ID_H__
#define __ID_H__
#ifndef XMRIG_ID_H
#define XMRIG_ID_H
#include <string.h>
@ -95,4 +95,4 @@ private:
} /* namespace xmrig */
#endif /* __ID_H__ */
#endif /* XMRIG_ID_H */

View file

@ -91,6 +91,12 @@ Job::~Job()
}
bool Job::isEqual(const Job &other) const
{
return m_id == other.m_id && m_clientId == other.m_clientId && memcmp(m_blob, other.m_blob, sizeof(m_blob)) == 0;
}
bool Job::setBlob(const char *blob)
{
if (!blob) {
@ -214,18 +220,6 @@ char *Job::toHex(const unsigned char* in, unsigned int len)
#endif
bool Job::operator==(const Job &other) const
{
return m_id == other.m_id && memcmp(m_blob, other.m_blob, sizeof(m_blob)) == 0;
}
bool Job::operator!=(const Job &other) const
{
return m_id != other.m_id || memcmp(m_blob, other.m_blob, sizeof(m_blob)) != 0;
}
xmrig::Variant Job::variant() const
{
using namespace xmrig;

View file

@ -42,6 +42,7 @@ public:
Job(int poolId, bool nicehash, const xmrig::Algorithm &algorithm, const xmrig::Id &clientId);
~Job();
bool isEqual(const Job &other) const;
bool setBlob(const char *blob);
bool setTarget(const char *target);
void setAlgorithm(const char *algo);
@ -81,8 +82,8 @@ public:
static char *toHex(const unsigned char* in, unsigned int len);
# endif
bool operator==(const Job &other) const;
bool operator!=(const Job &other) const;
inline bool operator==(const Job &other) const { return isEqual(other); }
inline bool operator!=(const Job &other) const { return !isEqual(other); }
private:
xmrig::Variant variant() const;