mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-19 02:25:52 +00:00
Operations on the raw socket can throw exceptions if it's no longer connected.
This commit is contained in:
@@ -1171,20 +1171,26 @@ void PeerImp::recvHello (protocol::TMHello& packet)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Take a guess at remotes address.
|
||||
std::string strIP = getNativeSocket ().remote_endpoint ().address ().to_string ();
|
||||
int iPort = packet.ipv4port ();
|
||||
try
|
||||
{
|
||||
// Take a guess at remotes address.
|
||||
std::string strIP = getNativeSocket ().remote_endpoint ().address ().to_string ();
|
||||
int iPort = packet.ipv4port ();
|
||||
|
||||
if (mHello.nodeprivate ())
|
||||
{
|
||||
WriteLog (lsINFO, Peer) << boost::str (boost::format ("Recv(Hello): Private connection: %s %s") % strIP % iPort);
|
||||
if (mHello.nodeprivate ())
|
||||
{
|
||||
WriteLog (lsINFO, Peer) << boost::str (boost::format ("Recv(Hello): Private connection: %s %s") % strIP % iPort);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Don't save IP address if the node wants privacy.
|
||||
// Note: We don't go so far as to delete it. If a node which has previously announced itself now wants
|
||||
// privacy, it should at least change its port.
|
||||
getApp().getPeers ().savePeer (strIP, iPort, UniqueNodeList::vsInbound);
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (boost::system::system_error const&)
|
||||
{
|
||||
// Don't save IP address if the node wants privacy.
|
||||
// Note: We don't go so far as to delete it. If a node which has previously announced itself now wants
|
||||
// privacy, it should at least change its port.
|
||||
getApp().getPeers ().savePeer (strIP, iPort, UniqueNodeList::vsInbound);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user