mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-12-23 03:49:23 +00:00
Code cleanup
This commit is contained in:
parent
b5fa34e1a1
commit
a9a2113ea4
2 changed files with 6 additions and 10 deletions
|
@ -1595,13 +1595,11 @@ bool p2pool::zmq_running() const
|
||||||
}
|
}
|
||||||
|
|
||||||
Params::Host p2pool::switch_host()
|
Params::Host p2pool::switch_host()
|
||||||
{
|
|
||||||
const Params::Host new_host = m_params->m_hosts[++m_currentHostIndex % m_params->m_hosts.size()];
|
|
||||||
{
|
{
|
||||||
WriteLock lock(m_currentHostLock);
|
WriteLock lock(m_currentHostLock);
|
||||||
m_currentHost = new_host;
|
|
||||||
}
|
m_currentHost = m_params->m_hosts[++m_currentHostIndex % m_params->m_hosts.size()];
|
||||||
return new_host;
|
return m_currentHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
void p2pool::reconnect_to_host()
|
void p2pool::reconnect_to_host()
|
||||||
|
@ -1620,11 +1618,9 @@ void p2pool::reconnect_to_host()
|
||||||
|
|
||||||
WriteLock lock(m_ZMQReaderLock);
|
WriteLock lock(m_ZMQReaderLock);
|
||||||
|
|
||||||
ZMQReader* old_reader = m_ZMQReader;
|
delete m_ZMQReader;
|
||||||
m_ZMQReader = nullptr;
|
m_ZMQReader = nullptr;
|
||||||
|
|
||||||
delete old_reader;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ZMQReader* new_reader = new ZMQReader(new_host.m_address, new_host.m_zmqPort, m_params->m_socks5Proxy, this);
|
ZMQReader* new_reader = new ZMQReader(new_host.m_address, new_host.m_zmqPort, m_params->m_socks5Proxy, this);
|
||||||
m_zmqLastActive = seconds_since_epoch();
|
m_zmqLastActive = seconds_since_epoch();
|
||||||
|
|
|
@ -2068,7 +2068,7 @@ void SideChain::prune_old_blocks()
|
||||||
m_pool->reconnect_to_host();
|
m_pool->reconnect_to_host();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pool && m_precalcFinished.load() && (cur_time >= m_firstPruneTime + 120)) {
|
if (cur_time >= m_firstPruneTime + 120) {
|
||||||
LOGINFO(0, log::LightGreen() << "[DEV] Synchronization finished successfully, stopping P2Pool now");
|
LOGINFO(0, log::LightGreen() << "[DEV] Synchronization finished successfully, stopping P2Pool now");
|
||||||
print_status(false);
|
print_status(false);
|
||||||
P2PServer* server = m_pool->p2p_server();
|
P2PServer* server = m_pool->p2p_server();
|
||||||
|
|
Loading…
Reference in a new issue