Browse Source

Allow peers to tell us of their actual IPs.

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

2
libp2p/Host.cpp

@ -312,7 +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();
cnote << "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

@ -164,9 +164,8 @@ bool Session::interpret(RLP const& _r)
if (isPrivateAddress(peerAddress) && !m_server->m_netPrefs.localNetworking)
goto CONTINUE;
// 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)))
if (id && (m_server->m_id == id || (m_id == id && isPrivateAddress(endpoint().address())) || m_server->m_incomingPeers.count(id)))
goto CONTINUE;
// check that we're not already connected to addr:

Loading…
Cancel
Save