mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-12-22 19:39:22 +00:00
Allow only one pending get_miner_data
This commit is contained in:
parent
516c382fe4
commit
5cea7be405
2 changed files with 9 additions and 1 deletions
|
@ -911,6 +911,8 @@ void p2pool::parse_get_version_rpc(const char* data, size_t size)
|
|||
|
||||
void p2pool::get_miner_data()
|
||||
{
|
||||
m_getMinerDataPending = true;
|
||||
|
||||
JSONRPCRequest::call(m_params->m_host.c_str(), m_params->m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_miner_data\"}",
|
||||
[this](const char* data, size_t size)
|
||||
{
|
||||
|
@ -923,6 +925,9 @@ void p2pool::get_miner_data()
|
|||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
get_miner_data();
|
||||
}
|
||||
else {
|
||||
m_getMinerDataPending = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1407,7 +1412,9 @@ void p2pool::restart_zmq()
|
|||
return;
|
||||
}
|
||||
|
||||
get_miner_data();
|
||||
if (!m_getMinerDataPending) {
|
||||
get_miner_data();
|
||||
}
|
||||
|
||||
delete m_ZMQReader;
|
||||
m_ZMQReader = nullptr;
|
||||
|
|
|
@ -204,6 +204,7 @@ private:
|
|||
ZMQReader* m_ZMQReader = nullptr;
|
||||
|
||||
hash m_getMinerDataHash;
|
||||
bool m_getMinerDataPending = false;
|
||||
};
|
||||
|
||||
} // namespace p2pool
|
||||
|
|
Loading…
Reference in a new issue