Skip to content

Commit

Permalink
rename received_no_error_goaway_ to reuse_connection_, and consolidat…
Browse files Browse the repository at this point in the history
…e with parent_.reuse_connection_ logic

Signed-off-by: Michael Puncel <[email protected]>
  • Loading branch information
mpuncel committed Oct 22, 2020
1 parent 447d07c commit 04458ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 4 additions & 4 deletions source/common/upstream/health_checker_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
}

Expand All @@ -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;
}

Expand Down Expand Up @@ -386,7 +386,7 @@ bool HttpHealthCheckerImpl::HttpActiveHealthCheckSession::shouldClose() const {
return false;
}

if (!parent_.reuse_connection_ || received_no_error_goaway_) {
if (!reuse_connection_) {
return true;
}

Expand Down
4 changes: 1 addition & 3 deletions source/common/upstream/health_checker_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down

0 comments on commit 04458ab

Please sign in to comment.