From 590d23f0d07ee038ac76f12586fb9a279ed04d9f Mon Sep 17 00:00:00 2001 From: Franciszek Koltuniuk Date: Mon, 5 Jun 2023 08:50:21 +0200 Subject: [PATCH] Added comment about the change in source code --- src/node_http_parser.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index 1d5404372b3130..e1944d90557316 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -1106,6 +1106,11 @@ void ConnectionsList::Expired(const FunctionCallbackInfo& args) { std::swap(headers_timeout, request_timeout); } + // On IoT or embedded devices the uv_hrtime() may return the timestamp + // that is smaller than configured timeout for headers or request + // to prevent subtracting two unsigned integers + // that can yield incorrect results we should check + // if the 'now' is bigger than the timeout for headers or request const uint64_t now = uv_hrtime(); const uint64_t headers_deadline = (headers_timeout > 0 && now > headers_timeout) ? now - headers_timeout