Flush the timer queue at each timer cancellation
When attempting to make parallel connections, the BMC is
not able to handle more than 25 connections. Found that the
timerQueue gets filled with both valid and expired timers.
The main timer fires every one second and flush the queue which
is not enough for BMCs with high speed processors.
So flushing the queue in TimerQueue::cancel() to make room for new
connections when the timers are cancelled.
Tested:
Tested on the BMC with high speed processor and able to make parallel
connections without failures.
Change-Id: Ib899f5ba3f60c009aeeff462f01d4b45522b803d
Signed-off-by: Karthick Sundarrajan <karthick.sundarrajan@intel.com>
diff --git a/http/timer_queue.hpp b/http/timer_queue.hpp
index 5baf7be..24a4ab4 100644
--- a/http/timer_queue.hpp
+++ b/http/timer_queue.hpp
@@ -32,6 +32,11 @@
{
dq[index].second = nullptr;
}
+ while (dq.begin() != dq.end() && dq.front().second == nullptr)
+ {
+ dq.pop_front();
+ step++;
+ }
}
std::optional<size_t> add(std::function<void()> f)