Sync changes with upcoming xmrig-proxy project.
This commit is contained in:
parent
57be6f94bb
commit
66d3e96a1a
17 changed files with 135 additions and 93 deletions
|
@ -50,15 +50,15 @@ DonateStrategy::DonateStrategy(const char *agent, IStrategyListener *listener) :
|
|||
}
|
||||
|
||||
|
||||
void DonateStrategy::connect()
|
||||
int64_t DonateStrategy::submit(const JobResult &result)
|
||||
{
|
||||
m_client->connect();
|
||||
return m_client->submit(result);
|
||||
}
|
||||
|
||||
|
||||
void DonateStrategy::submit(const JobResult &result)
|
||||
void DonateStrategy::connect()
|
||||
{
|
||||
m_client->submit(result);
|
||||
m_client->connect();
|
||||
}
|
||||
|
||||
|
||||
|
@ -84,9 +84,9 @@ void DonateStrategy::onLoginSuccess(Client *client)
|
|||
}
|
||||
|
||||
|
||||
void DonateStrategy::onResultAccepted(Client *client, uint32_t diff, uint64_t ms, const char *error)
|
||||
void DonateStrategy::onResultAccepted(Client *client, int64_t seq, uint32_t diff, uint64_t ms, const char *error)
|
||||
{
|
||||
m_listener->onResultAccepted(client, diff, ms, error);
|
||||
m_listener->onResultAccepted(client, seq, diff, ms, error);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -46,14 +46,14 @@ public:
|
|||
inline bool isActive() const override { return m_active; }
|
||||
inline void resume() override {}
|
||||
|
||||
int64_t submit(const JobResult &result) override;
|
||||
void connect() override;
|
||||
void submit(const JobResult &result) override;
|
||||
|
||||
protected:
|
||||
void onClose(Client *client, int failures) override;
|
||||
void onJobReceived(Client *client, const Job &job) override;
|
||||
void onLoginSuccess(Client *client) override;
|
||||
void onResultAccepted(Client *client, uint32_t diff, uint64_t ms, const char *error) override;
|
||||
void onResultAccepted(Client *client, int64_t seq, uint32_t diff, uint64_t ms, const char *error) override;
|
||||
|
||||
private:
|
||||
void idle();
|
||||
|
|
|
@ -39,6 +39,12 @@ FailoverStrategy::FailoverStrategy(const std::vector<Url*> &urls, const char *ag
|
|||
}
|
||||
|
||||
|
||||
int64_t FailoverStrategy::submit(const JobResult &result)
|
||||
{
|
||||
return m_pools[m_active]->submit(result);
|
||||
}
|
||||
|
||||
|
||||
void FailoverStrategy::connect()
|
||||
{
|
||||
m_pools[m_index]->connect();
|
||||
|
@ -55,12 +61,6 @@ void FailoverStrategy::resume()
|
|||
}
|
||||
|
||||
|
||||
void FailoverStrategy::submit(const JobResult &result)
|
||||
{
|
||||
m_pools[m_active]->submit(result);
|
||||
}
|
||||
|
||||
|
||||
void FailoverStrategy::onClose(Client *client, int failures)
|
||||
{
|
||||
if (failures == -1) {
|
||||
|
@ -111,9 +111,9 @@ void FailoverStrategy::onLoginSuccess(Client *client)
|
|||
}
|
||||
|
||||
|
||||
void FailoverStrategy::onResultAccepted(Client *client, uint32_t diff, uint64_t ms, const char *error)
|
||||
void FailoverStrategy::onResultAccepted(Client *client, int64_t seq, uint32_t diff, uint64_t ms, const char *error)
|
||||
{
|
||||
m_listener->onResultAccepted(client, diff, ms, error);
|
||||
m_listener->onResultAccepted(client, seq, diff, ms, error);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -45,15 +45,15 @@ public:
|
|||
public:
|
||||
inline bool isActive() const override { return m_active >= 0; }
|
||||
|
||||
int64_t submit(const JobResult &result) override;
|
||||
void connect() override;
|
||||
void resume() override;
|
||||
void submit(const JobResult &result) override;
|
||||
|
||||
protected:
|
||||
void onClose(Client *client, int failures) override;
|
||||
void onJobReceived(Client *client, const Job &job) override;
|
||||
void onLoginSuccess(Client *client) override;
|
||||
void onResultAccepted(Client *client, uint32_t diff, uint64_t ms, const char *error) override;
|
||||
void onResultAccepted(Client *client, int64_t seq, uint32_t diff, uint64_t ms, const char *error) override;
|
||||
|
||||
private:
|
||||
void add(const Url *url, const char *agent);
|
||||
|
|
|
@ -38,6 +38,12 @@ SinglePoolStrategy::SinglePoolStrategy(const Url *url, const char *agent, IStrat
|
|||
}
|
||||
|
||||
|
||||
int64_t SinglePoolStrategy::submit(const JobResult &result)
|
||||
{
|
||||
return m_client->submit(result);
|
||||
}
|
||||
|
||||
|
||||
void SinglePoolStrategy::connect()
|
||||
{
|
||||
m_client->connect();
|
||||
|
@ -54,12 +60,6 @@ void SinglePoolStrategy::resume()
|
|||
}
|
||||
|
||||
|
||||
void SinglePoolStrategy::submit(const JobResult &result)
|
||||
{
|
||||
m_client->submit(result);
|
||||
}
|
||||
|
||||
|
||||
void SinglePoolStrategy::onClose(Client *client, int failures)
|
||||
{
|
||||
if (!isActive()) {
|
||||
|
@ -84,7 +84,7 @@ void SinglePoolStrategy::onLoginSuccess(Client *client)
|
|||
}
|
||||
|
||||
|
||||
void SinglePoolStrategy::onResultAccepted(Client *client, uint32_t diff, uint64_t ms, const char *error)
|
||||
void SinglePoolStrategy::onResultAccepted(Client *client, int64_t seq, uint32_t diff, uint64_t ms, const char *error)
|
||||
{
|
||||
m_listener->onResultAccepted(client, diff, ms, error);
|
||||
m_listener->onResultAccepted(client, seq, diff, ms, error);
|
||||
}
|
||||
|
|
|
@ -42,15 +42,15 @@ public:
|
|||
public:
|
||||
inline bool isActive() const override { return m_active; }
|
||||
|
||||
int64_t submit(const JobResult &result) override;
|
||||
void connect() override;
|
||||
void resume() override;
|
||||
void submit(const JobResult &result) override;
|
||||
|
||||
protected:
|
||||
void onClose(Client *client, int failures) override;
|
||||
void onJobReceived(Client *client, const Job &job) override;
|
||||
void onLoginSuccess(Client *client) override;
|
||||
void onResultAccepted(Client *client, uint32_t diff, uint64_t ms, const char *error) override;
|
||||
void onResultAccepted(Client *client, int64_t seq, uint32_t diff, uint64_t ms, const char *error) override;
|
||||
|
||||
private:
|
||||
bool m_active;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue