Skip to content

Commit

Permalink
Avoid a race condition during peer status change
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelKatz authored and nbougalis committed Feb 25, 2019
1 parent 2529edd commit 9dbf849
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/ripple/overlay/impl/PeerImp.cpp
Expand Up @@ -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() &&
Expand Down

0 comments on commit 9dbf849

Please sign in to comment.