Commit 93ed89df authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Make stream timeout disable by default

It might be useful to clean the unused stream out to make up the room
for new streams.  On the other hand, proxy should maintain the
connection between upstream client and downstream server and they have
the timeout for their own.  Proxy just reacts to their decision.
parent 1a2e50ca
...@@ -489,10 +489,10 @@ void fill_default_config() ...@@ -489,10 +489,10 @@ void fill_default_config()
mod_config()->downstream_write_timeout = {30, 0}; mod_config()->downstream_write_timeout = {30, 0};
// Read timeout for HTTP/2 stream // Read timeout for HTTP/2 stream
mod_config()->stream_read_timeout = {30, 0}; mod_config()->stream_read_timeout = {0, 0};
// Write timeout for HTTP/2 stream // Write timeout for HTTP/2 stream
mod_config()->stream_write_timeout = {30, 0}; mod_config()->stream_write_timeout = {0, 0};
// Timeout for pooled (idle) connections // Timeout for pooled (idle) connections
mod_config()->downstream_idle_read_timeout = {60, 0}; mod_config()->downstream_idle_read_timeout = {60, 0};
...@@ -683,11 +683,12 @@ Timeout: ...@@ -683,11 +683,12 @@ Timeout:
<< get_config()->upstream_write_timeout.tv_sec << R"( << get_config()->upstream_write_timeout.tv_sec << R"(
--stream-read-timeout=<SEC> --stream-read-timeout=<SEC>
Specify read timeout for HTTP/2 and SPDY streams. Specify read timeout for HTTP/2 and SPDY streams.
0 means no timeout.
Default: )" Default: )"
<< get_config()->stream_read_timeout.tv_sec << R"( << get_config()->stream_read_timeout.tv_sec << R"(
--stream-write-timeout=<SEC> --stream-write-timeout=<SEC>
Specify write timeout for HTTP/2 and SPDY Specify write timeout for HTTP/2 and SPDY
streams. streams. 0 means no timeout.
Default: )" Default: )"
<< get_config()->stream_write_timeout.tv_sec << R"( << get_config()->stream_write_timeout.tv_sec << R"(
--backend-read-timeout=<SEC> --backend-read-timeout=<SEC>
......
...@@ -949,8 +949,13 @@ void Downstream::init_upstream_timer() ...@@ -949,8 +949,13 @@ void Downstream::init_upstream_timer()
{ {
auto evbase = upstream_->get_client_handler()->get_evbase(); auto evbase = upstream_->get_client_handler()->get_evbase();
if(get_config()->stream_read_timeout.tv_sec > 0) {
upstream_rtimerev_ = init_timer(evbase, upstream_rtimeoutcb, this); upstream_rtimerev_ = init_timer(evbase, upstream_rtimeoutcb, this);
}
if(get_config()->stream_write_timeout.tv_sec > 0) {
upstream_wtimerev_ = init_timer(evbase, upstream_wtimeoutcb, this); upstream_wtimerev_ = init_timer(evbase, upstream_wtimeoutcb, this);
}
} }
namespace { namespace {
...@@ -1074,8 +1079,13 @@ void Downstream::init_downstream_timer() ...@@ -1074,8 +1079,13 @@ void Downstream::init_downstream_timer()
{ {
auto evbase = upstream_->get_client_handler()->get_evbase(); auto evbase = upstream_->get_client_handler()->get_evbase();
if(get_config()->stream_read_timeout.tv_sec > 0) {
downstream_rtimerev_ = init_timer(evbase, downstream_rtimeoutcb, this); downstream_rtimerev_ = init_timer(evbase, downstream_rtimeoutcb, this);
}
if(get_config()->stream_write_timeout.tv_sec > 0) {
downstream_wtimerev_ = init_timer(evbase, downstream_wtimeoutcb, this); downstream_wtimerev_ = init_timer(evbase, downstream_wtimeoutcb, this);
}
} }
void Downstream::reset_downstream_rtimer() void Downstream::reset_downstream_rtimer()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment