mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Split peer connect logic to another class (RIPD-711):
All of the logic for establishing an outbound peer connection including the initial HTTP handshake exchange is moved into a separate class. This allows PeerImp to have a strong invariant: All PeerImp objects that exist represent active peer connections that have already gone through the handshake process.
This commit is contained in:
committed by
Nik Bougalis
parent
930a0beaf1
commit
32062e439f
@@ -207,6 +207,22 @@ parseHello (beast::http::message const& m, beast::Journal journal)
|
||||
// protocol version in TMHello is obsolete,
|
||||
// it is supplanted by the values in the headers.
|
||||
|
||||
{
|
||||
// Required
|
||||
auto const iter = h.find ("Upgrade");
|
||||
if (iter == h.end())
|
||||
return result;
|
||||
auto const versions = parse_ProtocolVersions(iter->second);
|
||||
if (versions.empty())
|
||||
return result;
|
||||
hello.set_protoversion(
|
||||
(static_cast<std::uint32_t>(versions.back().first) << 16) |
|
||||
(static_cast<std::uint32_t>(versions.back().second)));
|
||||
hello.set_protoversionmin(
|
||||
(static_cast<std::uint32_t>(versions.front().first) << 16) |
|
||||
(static_cast<std::uint32_t>(versions.front().second)));
|
||||
}
|
||||
|
||||
{
|
||||
// Required
|
||||
auto const iter = h.find ("Public-Key");
|
||||
|
||||
Reference in New Issue
Block a user