nghttpx: Don't send RST_STREAM to h2 backend if backend is disconnected state

This avoid establishing HTTP/2 backend connection again w/o pending
request.

See GH-431
This commit is contained in:
Tatsuhiro Tsujikawa 2015-11-22 15:23:18 +09:00
parent 72f2c4b272
commit dff2a19950
1 changed files with 4 additions and 9 deletions

View File

@ -67,14 +67,8 @@ Http2DownstreamConnection::~Http2DownstreamConnection() {
error_code = NGHTTP2_INTERNAL_ERROR; error_code = NGHTTP2_INTERNAL_ERROR;
} }
if (downstream_->get_downstream_stream_id() != -1) { if (http2session_->get_state() == Http2Session::CONNECTED &&
if (LOG_ENABLED(INFO)) { downstream_->get_downstream_stream_id() != -1) {
DCLOG(INFO, this) << "Submit RST_STREAM for DOWNSTREAM:" << downstream_
<< ", stream_id="
<< downstream_->get_downstream_stream_id()
<< ", error_code=" << error_code;
}
submit_rst_stream(downstream_, error_code); submit_rst_stream(downstream_, error_code);
http2session_->consume(downstream_->get_downstream_stream_id(), http2session_->consume(downstream_->get_downstream_stream_id(),
@ -143,7 +137,8 @@ int Http2DownstreamConnection::submit_rst_stream(Downstream *downstream,
if (LOG_ENABLED(INFO)) { if (LOG_ENABLED(INFO)) {
DCLOG(INFO, this) << "Submit RST_STREAM for DOWNSTREAM:" << downstream DCLOG(INFO, this) << "Submit RST_STREAM for DOWNSTREAM:" << downstream
<< ", stream_id=" << ", stream_id="
<< downstream->get_downstream_stream_id(); << downstream->get_downstream_stream_id()
<< ", error_code=" << error_code;
} }
rv = http2session_->submit_rst_stream( rv = http2session_->submit_rst_stream(
downstream->get_downstream_stream_id(), error_code); downstream->get_downstream_stream_id(), error_code);