Merge branch 'dev-addApiRebind' of https://github.com/Spudz76/xmrig into Spudz76-dev-addApiRebind
This commit is contained in:
commit
e80fc25789
@ -123,6 +123,20 @@ void xmrig::Api::stop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void xmrig::Api::tick()
|
||||||
|
{
|
||||||
|
# ifdef XMRIG_FEATURE_HTTP
|
||||||
|
if (!m_base->config()->http().isEnabled() || m_httpd->isBound()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (++m_ticks % 10 == 0) {
|
||||||
|
m_ticks = 0;
|
||||||
|
m_httpd->start();
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void xmrig::Api::onConfigChanged(Config *config, Config *previousConfig)
|
void xmrig::Api::onConfigChanged(Config *config, Config *previousConfig)
|
||||||
{
|
{
|
||||||
if (config->apiId() != previousConfig->apiId()) {
|
if (config->apiId() != previousConfig->apiId()) {
|
||||||
|
@ -54,6 +54,7 @@ public:
|
|||||||
void request(const HttpData &req);
|
void request(const HttpData &req);
|
||||||
void start();
|
void start();
|
||||||
void stop();
|
void stop();
|
||||||
|
void tick();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onConfigChanged(Config *config, Config *previousConfig) override;
|
void onConfigChanged(Config *config, Config *previousConfig) override;
|
||||||
@ -67,6 +68,7 @@ private:
|
|||||||
char m_id[32]{};
|
char m_id[32]{};
|
||||||
String m_workerId;
|
String m_workerId;
|
||||||
const uint64_t m_timestamp;
|
const uint64_t m_timestamp;
|
||||||
|
uint8_t m_ticks;
|
||||||
Httpd *m_httpd = nullptr;
|
Httpd *m_httpd = nullptr;
|
||||||
std::vector<IApiListener *> m_listeners;
|
std::vector<IApiListener *> m_listeners;
|
||||||
};
|
};
|
||||||
|
@ -48,6 +48,7 @@ public:
|
|||||||
|
|
||||||
bool start();
|
bool start();
|
||||||
void stop();
|
void stop();
|
||||||
|
inline const bool isBound() const { return m_server != nullptr; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onConfigChanged(Config *config, Config *previousConfig) override;
|
void onConfigChanged(Config *config, Config *previousConfig) override;
|
||||||
|
@ -308,6 +308,9 @@ void xmrig::Network::tick()
|
|||||||
if (m_donate) {
|
if (m_donate) {
|
||||||
m_donate->tick(now);
|
m_donate->tick(now);
|
||||||
}
|
}
|
||||||
|
#ifdef XMRIG_FEATURE_API
|
||||||
|
m_controller->api()->tick();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user