mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 19:45:53 +00:00
Be more tolerant of corrupt peer entries.
This commit is contained in:
@@ -110,7 +110,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (!mHello.has_ipv4port() || mIpPortConnect.first.empty())
|
if (!mHello.has_ipv4port() || mIpPortConnect.first.empty())
|
||||||
return false;
|
return false;
|
||||||
connect = boost::str(boost::format("%s:%d") % mIpPortConnect.first % mHello.ipv4port());
|
connect = boost::str(boost::format("%s %d") % mIpPortConnect.first % mHello.ipv4port());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1495,7 +1495,6 @@ void PeerImp::recvGetContacts (protocol::TMGetContacts& packet)
|
|||||||
|
|
||||||
// Return a list of your favorite people
|
// Return a list of your favorite people
|
||||||
// TODO: filter out all the LAN peers
|
// TODO: filter out all the LAN peers
|
||||||
// TODO: filter out the peer you are talking to
|
|
||||||
void PeerImp::recvGetPeers (protocol::TMGetPeers& packet, Application::ScopedLockType& masterLockHolder)
|
void PeerImp::recvGetPeers (protocol::TMGetPeers& packet, Application::ScopedLockType& masterLockHolder)
|
||||||
{
|
{
|
||||||
masterLockHolder.unlock ();
|
masterLockHolder.unlock ();
|
||||||
@@ -1512,12 +1511,20 @@ void PeerImp::recvGetPeers (protocol::TMGetPeers& packet, Application::ScopedLoc
|
|||||||
std::string strIP;
|
std::string strIP;
|
||||||
int iPort;
|
int iPort;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
splitIpPort (addrs[n], strIP, iPort);
|
splitIpPort (addrs[n], strIP, iPort);
|
||||||
|
|
||||||
// XXX This should also ipv6
|
// XXX This should also ipv6
|
||||||
protocol::TMIPv4EndPoint* addr = peers.add_nodes ();
|
protocol::TMIPv4EndPoint* addr = peers.add_nodes ();
|
||||||
addr->set_ipv4 (inet_addr (strIP.c_str ()));
|
addr->set_ipv4 (inet_addr (strIP.c_str ()));
|
||||||
addr->set_ipv4port (iPort);
|
addr->set_ipv4port (iPort);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
WriteLog (lsWARNING, Peer) << "Bad peer in list: " << addrs[n];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//WriteLog (lsINFO, Peer) << "Peer: Teaching: " << addressToString(this) << ": " << n << ": " << strIP << " " << iPort;
|
//WriteLog (lsINFO, Peer) << "Peer: Teaching: " << addressToString(this) << ": " << n << ": " << strIP << " " << iPort;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ private:
|
|||||||
void splitIpPort (const std::string& strIpPort, std::string& strIp, int& iPort)
|
void splitIpPort (const std::string& strIpPort, std::string& strIp, int& iPort)
|
||||||
{
|
{
|
||||||
std::vector<std::string> vIpPort;
|
std::vector<std::string> vIpPort;
|
||||||
boost::split (vIpPort, strIpPort, boost::is_any_of (" "));
|
boost::split (vIpPort, strIpPort, boost::is_any_of (" :"));
|
||||||
|
|
||||||
strIp = vIpPort[0];
|
strIp = vIpPort[0];
|
||||||
iPort = lexicalCastThrow <int> (vIpPort[1]);
|
iPort = lexicalCastThrow <int> (vIpPort[1]);
|
||||||
|
|||||||
Reference in New Issue
Block a user