mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Replace from_string_checked pair return type with optional<Endpoint>
This commit is contained in:
@@ -1304,11 +1304,11 @@ PeerImp::onMessage(std::shared_ptr <protocol::TMPeerShardInfo> const& m)
|
||||
{
|
||||
if (m->endpoint() != "0")
|
||||
{
|
||||
auto [result, validResult] =
|
||||
auto result =
|
||||
beast::IP::Endpoint::from_string_checked(m->endpoint());
|
||||
if (!validResult)
|
||||
if (!result)
|
||||
return badData("Invalid incoming endpoint: " + m->endpoint());
|
||||
endpoint = std::move(result);
|
||||
endpoint = std::move(*result);
|
||||
}
|
||||
}
|
||||
else if (crawl()) // Check if peer will share IP publicly
|
||||
@@ -1384,8 +1384,8 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMEndpoints> const& m)
|
||||
for (auto const& tm : m->endpoints_v2 ())
|
||||
{
|
||||
// these endpoint strings support ipv4 and ipv6
|
||||
auto [result, validResult] = beast::IP::Endpoint::from_string_checked(tm.endpoint());
|
||||
if (! validResult)
|
||||
auto result = beast::IP::Endpoint::from_string_checked(tm.endpoint());
|
||||
if (! result)
|
||||
{
|
||||
JLOG(p_journal_.error()) <<
|
||||
"failed to parse incoming endpoint: {" <<
|
||||
@@ -1402,8 +1402,8 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMEndpoints> const& m)
|
||||
|
||||
endpoints.emplace_back(
|
||||
tm.hops() > 0 ?
|
||||
result :
|
||||
remote_address_.at_port(result.port()),
|
||||
*result :
|
||||
remote_address_.at_port(result->port()),
|
||||
tm.hops());
|
||||
JLOG(p_journal_.trace()) <<
|
||||
"got v2 EP: " << endpoints.back().address <<
|
||||
|
||||
Reference in New Issue
Block a user