Fix timeout issue during image upload
This commit fixes timeout issues when transfering bigger payloads
like update image.
Tested by uploading image:
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/octet-stream" \
-X POST -T test.tar https://$bmc/upload/image
# slow connection upload (~10kB/s)
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/octet-stream" \
-X POST -T test.tar https://$bmc/upload/image --limit-rate 10k
Signed-off-by: Jan Sowinski <jan.sowinski@intel.com>
Change-Id: I913136013afb58c97071819288460f4cb64d0d83
diff --git a/http/timer_queue.h b/http/timer_queue.h
index 26eea13..7339d66 100644
--- a/http/timer_queue.h
+++ b/http/timer_queue.h
@@ -45,12 +45,15 @@
while (!dq.empty())
{
auto& x = dq.front();
- if (now - x.first < std::chrono::seconds(5))
- {
- break;
- }
+ // Check expiration time only for active handlers,
+ // remove canceled ones immediately
if (x.second)
{
+ if (now - x.first < std::chrono::seconds(5))
+ {
+ break;
+ }
+
BMCWEB_LOG_DEBUG << "timer call: " << this << ' ' << step;
// we know that timer handlers are very simple currenty; call
// here