Remove conditional check for feature introduced in 0.28.1-b7

This commit is contained in:
Crypto Brad Garlinghouse
2018-09-22 20:58:50 +00:00
committed by Nik Bougalis
parent cd820b3777
commit aa49be65a1
4 changed files with 25 additions and 59 deletions

View File

@@ -1088,12 +1088,10 @@ OverlayImpl::send (protocol::TMProposeSet& m)
{
if (setup_.expire)
m.set_hops(0);
auto const sm = std::make_shared<Message>(
m, protocol::mtPROPOSE_LEDGER);
auto const sm = std::make_shared<Message>(m, protocol::mtPROPOSE_LEDGER);
for_each([&](std::shared_ptr<PeerImp>&& p)
{
if (! m.has_hops() || p->hopsAware())
p->send(sm);
p->send(sm);
});
}
void
@@ -1101,12 +1099,10 @@ OverlayImpl::send (protocol::TMValidation& m)
{
if (setup_.expire)
m.set_hops(0);
auto const sm = std::make_shared<Message>(
m, protocol::mtVALIDATION);
auto const sm = std::make_shared<Message>(m, protocol::mtVALIDATION);
for_each([&](std::shared_ptr<PeerImp>&& p)
{
if (! m.has_hops() || p->hopsAware())
p->send(sm);
p->send(sm);
});
SerialIter sit (m.validation().data(), m.validation().size());
@@ -1120,43 +1116,35 @@ OverlayImpl::send (protocol::TMValidation& m)
}
void
OverlayImpl::relay (protocol::TMProposeSet& m,
uint256 const& uid)
OverlayImpl::relay (protocol::TMProposeSet& m, uint256 const& uid)
{
if (m.has_hops() && m.hops() >= maxTTL)
return;
auto const toSkip = app_.getHashRouter().shouldRelay(uid);
if (!toSkip)
return;
auto const sm = std::make_shared<Message>(
m, protocol::mtPROPOSE_LEDGER);
for_each([&](std::shared_ptr<PeerImp>&& p)
if (auto const toSkip = app_.getHashRouter().shouldRelay(uid))
{
if (toSkip->find(p->id()) != toSkip->end())
return;
if (! m.has_hops() || p->hopsAware())
p->send(sm);
});
auto const sm = std::make_shared<Message>(m, protocol::mtPROPOSE_LEDGER);
for_each([&](std::shared_ptr<PeerImp>&& p)
{
if (toSkip->find(p->id()) == toSkip->end())
p->send(sm);
});
}
}
void
OverlayImpl::relay (protocol::TMValidation& m,
uint256 const& uid)
OverlayImpl::relay (protocol::TMValidation& m, uint256 const& uid)
{
if (m.has_hops() && m.hops() >= maxTTL)
return;
auto const toSkip = app_.getHashRouter().shouldRelay(uid);
if (! toSkip)
return;
auto const sm = std::make_shared<Message>(
m, protocol::mtVALIDATION);
for_each([&](std::shared_ptr<PeerImp>&& p)
if (auto const toSkip = app_.getHashRouter().shouldRelay(uid))
{
if (toSkip->find(p->id()) != toSkip->end())
return;
if (! m.has_hops() || p->hopsAware())
p->send(sm);
});
auto const sm = std::make_shared<Message>(m, protocol::mtVALIDATION);
for_each([&](std::shared_ptr<PeerImp>&& p)
{
if (toSkip->find(p->id()) == toSkip->end())
p->send(sm);
});
}
}
//------------------------------------------------------------------------------
@@ -1248,6 +1236,7 @@ Overlay::Setup
setup_Overlay (BasicConfig const& config)
{
Overlay::Setup setup;
{
auto const& section = config.section("overlay");
setup.context = make_SSLContext("");

View File

@@ -41,6 +41,7 @@
#include <cassert>
#include <chrono>
#include <condition_variable>
#include <cstdint>
#include <memory>
#include <mutex>
#include <unordered_map>
@@ -50,10 +51,7 @@ namespace ripple {
class PeerImp;
class BasicConfig;
enum
{
maxTTL = 2
};
constexpr std::uint32_t maxTTL = 2;
class OverlayImpl : public Overlay
{

View File

@@ -104,20 +104,6 @@ PeerImp::run()
if(! strand_.running_in_this_thread())
return strand_.post(std::bind (
&PeerImp::run, shared_from_this()));
{
auto s = getVersion();
if (boost::starts_with(s, "rippled-"))
{
s.erase(s.begin(), s.begin() + 8);
beast::SemanticVersion v;
if (v.parse(s))
{
beast::SemanticVersion av;
av.parse("0.28.1-b7");
hopsAware_ = v >= av;
}
}
}
if (m_inbound)
{
doAccept();

View File

@@ -160,7 +160,6 @@ private:
int large_sendq_ = 0;
int no_ping_ = 0;
std::unique_ptr <LoadEvent> load_event_;
bool hopsAware_ = false;
std::mutex mutable shardInfoMutex_;
hash_map<PublicKey, ShardInfo> shardInfo_;
@@ -255,12 +254,6 @@ public:
return slot_->cluster();
}
bool
hopsAware() const
{
return hopsAware_;
}
void
check();