mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 06:25:51 +00:00
Fix case where slot==nullptr in Overlay:
This changes the Overlay to correctly handle the case when nullptr is returned by PeerFinder new_inbound_slot on a detected self-connection.
This commit is contained in:
committed by
Nik Bougalis
parent
a3204a4df7
commit
0e1dd92d9b
@@ -161,7 +161,8 @@ OverlayImpl::onLegacyPeerHello (
|
|||||||
beast::IPAddressConversion::from_asio(local_endpoint),
|
beast::IPAddressConversion::from_asio(local_endpoint),
|
||||||
beast::IPAddressConversion::from_asio(remote_address));
|
beast::IPAddressConversion::from_asio(remote_address));
|
||||||
|
|
||||||
addpeer (std::make_shared<PeerImp>(std::move(ssl_bundle),
|
if (slot != nullptr)
|
||||||
|
return addpeer (std::make_shared<PeerImp>(std::move(ssl_bundle),
|
||||||
boost::asio::const_buffers_1(buffer),
|
boost::asio::const_buffers_1(buffer),
|
||||||
beast::IPAddressConversion::from_asio(remote_address),
|
beast::IPAddressConversion::from_asio(remote_address),
|
||||||
*this, m_resourceManager, *m_peerFinder, slot));
|
*this, m_resourceManager, *m_peerFinder, slot));
|
||||||
@@ -192,23 +193,17 @@ OverlayImpl::onHandoff (std::unique_ptr <beast::asio::ssl_bundle>&& ssl_bundle,
|
|||||||
beast::IPAddressConversion::from_asio(local_endpoint),
|
beast::IPAddressConversion::from_asio(local_endpoint),
|
||||||
beast::IPAddressConversion::from_asio(remote_address));
|
beast::IPAddressConversion::from_asio(remote_address));
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (slot == nullptr)
|
if (slot == nullptr)
|
||||||
#else
|
|
||||||
// For now, always redirect.
|
|
||||||
if (true)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// Full, give them some addresses
|
// self connect
|
||||||
handoff.response = makeRedirectResponse(slot, request);
|
handoff.moved = false;
|
||||||
handoff.keep_alive = request.keep_alive();
|
|
||||||
return handoff;
|
return handoff;
|
||||||
}
|
}
|
||||||
|
|
||||||
addpeer (std::make_shared<PeerImp>(std::move(ssl_bundle),
|
// For now, always redirect
|
||||||
std::move(request), beast::IPAddressConversion::from_asio(remote_address),
|
// Full, give them some addresses
|
||||||
*this, m_resourceManager, *m_peerFinder, slot));
|
handoff.response = makeRedirectResponse(slot, request);
|
||||||
handoff.moved = true;
|
handoff.keep_alive = request.keep_alive();
|
||||||
return handoff;
|
return handoff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user