Browse Source

Merge branch 'downloadman' into develop

cl-refactor
Gav Wood 10 years ago
parent
commit
f435abe880
  1. 1
      libp2p/Host.cpp
  2. 3
      libp2p/Session.cpp

1
libp2p/Host.cpp

@ -312,6 +312,7 @@ std::map<h512, bi::tcp::endpoint> Host::potentialPeers()
if (auto j = i.second.lock())
{
auto ep = j->endpoint();
cdebug << "Checking potential peer" << j->m_listenPort << j->endpoint() << isPrivateAddress(ep.address()) << ep.port() << j->m_id.abridged();
// Skip peers with a listen port of zero or are on a private network
bool peerOnNet = (j->m_listenPort != 0 && (!isPrivateAddress(ep.address()) || m_netPrefs.localNetworking));
if (peerOnNet && ep.port() && j->m_id)

3
libp2p/Session.cpp

@ -159,10 +159,11 @@ bool Session::interpret(RLP const& _r)
bi::address_v4 peerAddress(_r[i][0].toHash<FixedHash<4>>().asArray());
auto ep = bi::tcp::endpoint(peerAddress, _r[i][1].toInt<short>());
h512 id = _r[i][2].toHash<h512>();
clogS(NetAllDetail) << "Checking: " << ep << "(" << id.abridged() << ")";
if (isPrivateAddress(peerAddress) && !m_server->m_netPrefs.localNetworking)
goto CONTINUE;
clogS(NetAllDetail) << "Checking: " << ep << "(" << id.abridged() << ")";
// check that it's not us or one we already know:
if (id && (m_server->m_id == id || m_server->havePeer(id) || m_server->m_incomingPeers.count(id)))

Loading…
Cancel
Save