Sync changes.

This commit is contained in:
XMRig 2019-02-08 16:55:21 +07:00
parent a6a0fb965a
commit 1a2aaf210c
10 changed files with 107 additions and 45 deletions

View file

@ -203,10 +203,10 @@ rapidjson::Value Pool::toJSON(rapidjson::Document &doc) const
Value obj(kObjectType);
obj.AddMember("url", StringRef(url()), allocator);
obj.AddMember("user", StringRef(user()), allocator);
obj.AddMember("pass", StringRef(password()), allocator);
obj.AddMember("rig-id", rigId() ? Value(StringRef(rigId())).Move() : Value(kNullType).Move(), allocator);
obj.AddMember("url", m_url.toJSON(), allocator);
obj.AddMember("user", m_user.toJSON(), allocator);
obj.AddMember("pass", m_password.toJSON(), allocator);
obj.AddMember("rig-id", m_rigId.toJSON(), allocator);
# ifndef XMRIG_PROXY_PROJECT
obj.AddMember("nicehash", isNicehash(), allocator);
@ -223,17 +223,20 @@ rapidjson::Value Pool::toJSON(rapidjson::Document &doc) const
case xmrig::VARIANT_AUTO:
case xmrig::VARIANT_0:
case xmrig::VARIANT_1:
case xmrig::VARIANT_2:
obj.AddMember("variant", m_algorithm.variant(), allocator);
break;
case xmrig::VARIANT_2:
obj.AddMember("variant", 2, allocator);
break;
default:
obj.AddMember("variant", StringRef(m_algorithm.variantName()), allocator);
break;
}
obj.AddMember("tls", isTLS(), allocator);
obj.AddMember("tls-fingerprint", fingerprint() ? Value(StringRef(fingerprint())).Move() : Value(kNullType).Move(), allocator);
obj.AddMember("tls-fingerprint", m_fingerprint.toJSON(), allocator);
return obj;
}

View file

@ -5,7 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -76,6 +77,14 @@ void FailoverStrategy::resume()
}
void FailoverStrategy::setAlgo(const xmrig::Algorithm &algo)
{
for (Client *client : m_pools) {
client->setAlgo(algo);
}
}
void FailoverStrategy::stop()
{
for (size_t i = 0; i < m_pools.size(); ++i) {

View file

@ -5,7 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -21,8 +22,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __FAILOVERSTRATEGY_H__
#define __FAILOVERSTRATEGY_H__
#ifndef XMRIG_FAILOVERSTRATEGY_H
#define XMRIG_FAILOVERSTRATEGY_H
#include <vector>
@ -42,7 +43,7 @@ class FailoverStrategy : public IStrategy, public IClientListener
{
public:
FailoverStrategy(const std::vector<Pool> &urls, int retryPause, int retries, IStrategyListener *listener, bool quiet = false);
~FailoverStrategy();
~FailoverStrategy() override;
public:
inline bool isActive() const override { return m_active >= 0; }
@ -50,6 +51,7 @@ public:
int64_t submit(const JobResult &result) override;
void connect() override;
void resume() override;
void setAlgo(const xmrig::Algorithm &algo) override;
void stop() override;
void tick(uint64_t now) override;
@ -71,4 +73,4 @@ private:
std::vector<Client*> m_pools;
};
#endif /* __FAILOVERSTRATEGY_H__ */
#endif /* XMRIG_FAILOVERSTRATEGY_H */

View file

@ -5,7 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -68,6 +69,12 @@ void SinglePoolStrategy::resume()
}
void SinglePoolStrategy::setAlgo(const xmrig::Algorithm &algo)
{
m_client->setAlgo(algo);
}
void SinglePoolStrategy::stop()
{
m_client->disconnect();

View file

@ -5,7 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -21,8 +22,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SINGLEPOOLSTRATEGY_H__
#define __SINGLEPOOLSTRATEGY_H__
#ifndef XMRIG_SINGLEPOOLSTRATEGY_H
#define XMRIG_SINGLEPOOLSTRATEGY_H
#include "common/interfaces/IClientListener.h"
@ -31,14 +32,14 @@
class Client;
class IStrategyListener;
class Url;
class Pool;
class SinglePoolStrategy : public IStrategy, public IClientListener
{
public:
SinglePoolStrategy(const Pool &pool, int retryPause, int retries, IStrategyListener *listener, bool quiet = false);
~SinglePoolStrategy();
~SinglePoolStrategy() override;
public:
inline bool isActive() const override { return m_active; }
@ -46,6 +47,7 @@ public:
int64_t submit(const JobResult &result) override;
void connect() override;
void resume() override;
void setAlgo(const xmrig::Algorithm &algo) override;
void stop() override;
void tick(uint64_t now) override;
@ -61,4 +63,4 @@ private:
IStrategyListener *m_listener;
};
#endif /* __SINGLEPOOLSTRATEGY_H__ */
#endif /* XMRIG_SINGLEPOOLSTRATEGY_H */