Limit the total number of offers processed while crossing

This commit is contained in:
Nik Bougalis
2015-09-08 11:56:10 -07:00
parent 3759c553b0
commit a50d67257c
8 changed files with 222 additions and 10 deletions

View File

@@ -25,13 +25,14 @@ namespace ripple {
OfferStream::OfferStream (ApplyView& view, ApplyView& cancelView,
BookRef book, Clock::time_point when,
beast::Journal journal)
StepCounter& counter, beast::Journal journal)
: j_ (journal)
, view_ (view)
, cancelView_ (cancelView)
, book_ (book)
, expire_ (when)
, tip_ (view, book_)
, counter_ (counter)
{
}
@@ -89,6 +90,10 @@ OfferStream::step ()
std::shared_ptr<SLE> entry = tip_.entry();
// If we exceed the maximum number of allowed steps, we're done.
if (!counter_.step ())
return false;
// Remove if missing
if (! entry)
{