Skip to content

Commit

Permalink
MSVC FIX
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Mar 7, 2024
1 parent 50913e2 commit c6f09af
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions nano/node/fair_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,17 @@ class fair_queue_base final
debug_assert (!empty ()); // Should be checked before calling next

auto should_seek = [&, this] () {
if (current_queue == queues.end ())
if (iterator == queues.end ())
{
return true;
}
auto & queue = current_queue->second;
auto & queue = iterator->second;
if (queue.empty ())
{
return true;
}
// Allow up to `queue.priority` requests to be processed before moving to the next queue
if (current_queue_counter >= queue.priority)
if (counter >= queue.priority)
{
return true;
}
Expand All @@ -215,12 +215,12 @@ class fair_queue_base final
seek_next ();
}

release_assert (current_queue != queues.end ());
release_assert (iterator != queues.end ());

auto & source = current_queue->first;
auto & queue = current_queue->second;
auto & source = iterator->first;
auto & queue = iterator->second;

++current_queue_counter;
++counter;
return { queue.pop (), source };
}

Expand All @@ -238,25 +238,25 @@ class fair_queue_base final
private:
void seek_next ()
{
current_queue_counter = 0;
counter = 0;
do
{
if (current_queue != queues.end ())
if (iterator != queues.end ())
{
++current_queue;
++iterator;
}
if (current_queue == queues.end ())
if (iterator == queues.end ())
{
current_queue = queues.begin ();
iterator = queues.begin ();
}
release_assert (current_queue != queues.end ());
} while (current_queue->second.empty ());
release_assert (iterator != queues.end ());
} while (iterator->second.empty ());
}

void cleanup ()
{
// Invalidate the current iterator
current_queue = queues.end ();
iterator = queues.end ();

erase_if (queues, [] (auto const & entry) {
return !entry.first.alive ();
Expand All @@ -265,8 +265,8 @@ class fair_queue_base final

private:
std::map<source_type, entry> queues;
decltype (queues)::iterator current_queue{ queues.end () };
size_t current_queue_counter{ 0 };
std::map<source_type, entry>::iterator iterator{ queues.end () };
size_t counter{ 0 };

std::chrono::steady_clock::time_point last_cleanup{};

Expand Down

0 comments on commit c6f09af

Please sign in to comment.