summaryrefslogtreecommitdiffstats
path: root/src/shrpx_downstream.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 08:53:16 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 08:53:16 +0000
commitfef16cb88298ba07a9841a5a98e5afaa48bcb6d6 (patch)
tree4c895c4ad1fdad31773ded63e5a1effb74185315 /src/shrpx_downstream.cc
parentReleasing progress-linux version 1.60.0-1~progress7.99u1. (diff)
downloadnghttp2-fef16cb88298ba07a9841a5a98e5afaa48bcb6d6.tar.xz
nghttp2-fef16cb88298ba07a9841a5a98e5afaa48bcb6d6.zip
Merging upstream version 1.61.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/shrpx_downstream.cc')
-rw-r--r--src/shrpx_downstream.cc38
1 files changed, 37 insertions, 1 deletions
diff --git a/src/shrpx_downstream.cc b/src/shrpx_downstream.cc
index 9ea52b4..5fd717e 100644
--- a/src/shrpx_downstream.cc
+++ b/src/shrpx_downstream.cc
@@ -46,6 +46,23 @@
namespace shrpx {
namespace {
+void header_timeoutcb(struct ev_loop *loop, ev_timer *w, int revents) {
+ auto downstream = static_cast<Downstream *>(w->data);
+ auto upstream = downstream->get_upstream();
+
+ if (LOG_ENABLED(INFO)) {
+ DLOG(INFO, downstream) << "request header timeout stream_id="
+ << downstream->get_stream_id();
+ }
+
+ downstream->disable_upstream_rtimer();
+ downstream->disable_upstream_wtimer();
+
+ upstream->on_timeout(downstream);
+}
+} // namespace
+
+namespace {
void upstream_timeoutcb(struct ev_loop *loop, ev_timer *w, int revents) {
auto downstream = static_cast<Downstream *>(w->data);
auto upstream = downstream->get_upstream();
@@ -148,7 +165,12 @@ Downstream::Downstream(Upstream *upstream, MemchunkPool *mcpool,
expect_100_continue_(false),
stop_reading_(false) {
- auto &timeoutconf = get_config()->http2.timeout;
+ auto config = get_config();
+ auto &httpconf = config->http;
+
+ ev_timer_init(&header_timer_, header_timeoutcb, 0., httpconf.timeout.header);
+
+ auto &timeoutconf = config->http2.timeout;
ev_timer_init(&upstream_rtimer_, &upstream_rtimeoutcb, 0.,
timeoutconf.stream_read);
@@ -159,6 +181,7 @@ Downstream::Downstream(Upstream *upstream, MemchunkPool *mcpool,
ev_timer_init(&downstream_wtimer_, &downstream_wtimeoutcb, 0.,
timeoutconf.stream_write);
+ header_timer_.data = this;
upstream_rtimer_.data = this;
upstream_wtimer_.data = this;
downstream_rtimer_.data = this;
@@ -183,6 +206,7 @@ Downstream::~Downstream() {
ev_timer_stop(loop, &upstream_wtimer_);
ev_timer_stop(loop, &downstream_rtimer_);
ev_timer_stop(loop, &downstream_wtimer_);
+ ev_timer_stop(loop, &header_timer_);
#ifdef HAVE_MRUBY
auto handler = upstream_->get_client_handler();
@@ -946,6 +970,18 @@ bool Downstream::expect_response_trailer() const {
(resp_.http_major == 3 || resp_.http_major == 2);
}
+void Downstream::repeat_header_timer() {
+ auto loop = upstream_->get_client_handler()->get_loop();
+
+ ev_timer_again(loop, &header_timer_);
+}
+
+void Downstream::stop_header_timer() {
+ auto loop = upstream_->get_client_handler()->get_loop();
+
+ ev_timer_stop(loop, &header_timer_);
+}
+
namespace {
void reset_timer(struct ev_loop *loop, ev_timer *w) { ev_timer_again(loop, w); }
} // namespace