Skip to content
Permalink
Browse files

Avoid a race condition during peer status change

  • Loading branch information...
JoelKatz authored and nbougalis committed Feb 23, 2019
1 parent 2529edd commit 9dbf8495eed1f8e862fe69869bba56a694e00815
Showing with 4 additions and 6 deletions.
  1. +4 −6 src/ripple/overlay/impl/PeerImp.cpp
@@ -1658,15 +1658,13 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMStatusChange> const& m)

if (m->has_firstseq () && m->has_lastseq())
{
std::lock_guard<std::mutex> sl (recentLock_);

minLedger_ = m->firstseq ();
maxLedger_ = m->lastseq ();

// VFALCO Is this workaround still needed?
// Work around some servers that report sequences incorrectly
if (minLedger_ == 0)
maxLedger_ = 0;
if (maxLedger_ == 0)
minLedger_ = 0;
if ((maxLedger_ < minLedger_) || (minLedger_ == 0) || (maxLedger_ == 0))
minLedger_ = maxLedger_ = 0;
}

if (m->has_ledgerseq() &&

0 comments on commit 9dbf849

Please sign in to comment.
You can’t perform that action at this time.