From 04458ab48ebcf7070228eecdfa2354dce8c96328 Mon Sep 17 00:00:00 2001 From: Michael Puncel Date: Wed, 21 Oct 2020 22:41:10 -0400 Subject: [PATCH] rename received_no_error_goaway_ to reuse_connection_, and consolidate with parent_.reuse_connection_ logic Signed-off-by: Michael Puncel --- source/common/upstream/health_checker_impl.cc | 8 ++++---- source/common/upstream/health_checker_impl.h | 4 +--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/source/common/upstream/health_checker_impl.cc b/source/common/upstream/health_checker_impl.cc index 35e0456a8f88..e8cbff3d1fed 100644 --- a/source/common/upstream/health_checker_impl.cc +++ b/source/common/upstream/health_checker_impl.cc @@ -258,7 +258,7 @@ void HttpHealthCheckerImpl::HttpActiveHealthCheckSession::onInterval() { client_->addConnectionCallbacks(connection_callback_impl_); client_->setCodecConnectionCallbacks(http_connection_callback_impl_); expect_reset_ = false; - received_no_error_goaway_ = false; + reuse_connection_ = parent_.reuse_connection_; } Http::RequestEncoder* request_encoder = &client_->newStream(*this); @@ -285,7 +285,7 @@ void HttpHealthCheckerImpl::HttpActiveHealthCheckSession::onResetStream(Http::St request_in_flight_ = false; ENVOY_CONN_LOG(debug, "connection/stream error health_flags={}", *client_, HostUtility::healthFlagsToString(*host_)); - if (client_ && received_no_error_goaway_) { + if (client_ && !reuse_connection_) { client_->close(); } @@ -312,7 +312,7 @@ void HttpHealthCheckerImpl::HttpActiveHealthCheckSession::onGoAway( // The server is starting a graceful shutdown. Allow the in flight request // to finish without treating this as a health check error, and then // reconnect. - received_no_error_goaway_ = true; + reuse_connection_ = false; return; } @@ -386,7 +386,7 @@ bool HttpHealthCheckerImpl::HttpActiveHealthCheckSession::shouldClose() const { return false; } - if (!parent_.reuse_connection_ || received_no_error_goaway_) { + if (!reuse_connection_) { return true; } diff --git a/source/common/upstream/health_checker_impl.h b/source/common/upstream/health_checker_impl.h index f935f13701e0..cf7628461d0c 100644 --- a/source/common/upstream/health_checker_impl.h +++ b/source/common/upstream/health_checker_impl.h @@ -138,9 +138,7 @@ class HttpHealthCheckerImpl : public HealthCheckerImplBase { const Http::Protocol protocol_; Network::Address::InstanceConstSharedPtr local_address_; bool expect_reset_{}; - // If true, we received a GOAWAY (NO_ERROR code) and are deferring closing the connection - // until the active probe completes. - bool received_no_error_goaway_ = false; + bool reuse_connection_ = false; bool request_in_flight_ = false; };