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

View File

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

View File

@@ -104,20 +104,6 @@ PeerImp::run()
if(! strand_.running_in_this_thread()) if(! strand_.running_in_this_thread())
return strand_.post(std::bind ( return strand_.post(std::bind (
&PeerImp::run, shared_from_this())); &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) if (m_inbound)
{ {
doAccept(); doAccept();

View File

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