Browse Source

cleanup

cl-refactor
subtly 10 years ago
parent
commit
826858496c
  1. 5
      libp2p/Host.cpp

5
libp2p/Host.cpp

@ -639,11 +639,13 @@ void Host::run(boost::system::error_code const&)
if (p->required && reqConn++ < m_idealPeerCount) if (p->required && reqConn++ < m_idealPeerCount)
connect(p); connect(p);
if (!m_netPrefs.pin)
{
unsigned pendingCount = 0; unsigned pendingCount = 0;
DEV_GUARDED(x_pendingNodeConns) DEV_GUARDED(x_pendingNodeConns)
pendingCount = m_pendingPeerConns.size(); pendingCount = m_pendingPeerConns.size();
int openSlots = m_idealPeerCount - peerCount() - pendingCount + reqConn; int openSlots = m_idealPeerCount - peerCount() - pendingCount + reqConn;
if (openSlots > 0 && !m_netPrefs.pin) if (openSlots > 0)
{ {
for (auto p: toConnect) for (auto p: toConnect)
if (!p->required && openSlots--) if (!p->required && openSlots--)
@ -651,6 +653,7 @@ void Host::run(boost::system::error_code const&)
m_nodeTable->discover(); m_nodeTable->discover();
} }
}
auto runcb = [this](boost::system::error_code const& error) { run(error); }; auto runcb = [this](boost::system::error_code const& error) { run(error); };
m_timer->expires_from_now(boost::posix_time::milliseconds(c_timerInterval)); m_timer->expires_from_now(boost::posix_time::milliseconds(c_timerInterval));

Loading…
Cancel
Save