Skip to content

Commit

Permalink
envoy: 71248e512 (#2027)
Browse files Browse the repository at this point in the history
Changes: envoyproxy/envoy@519774f...71248e5

Signed-off-by: JP Simard <[email protected]>
  • Loading branch information
jpsim authored Feb 3, 2022
1 parent c4025df commit 3464962
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion envoy
Submodule envoy updated 142 files
14 changes: 12 additions & 2 deletions library/common/extensions/filters/http/platform_bridge/filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,18 @@ void PlatformBridgeFilter::onDestroy() {
ENVOY_LOG(trace, "PlatformBridgeFilter({})::onDestroy", filter_name_);
alive_ = false;

// If the filter chain is destroyed before a response is received, treat as cancellation.
if (!response_filter_base_->state_.stream_complete_ && platform_filter_.on_cancel) {
auto& info = decoder_callbacks_->streamInfo();
if (response_filter_base_->state_.stream_complete_ && platform_filter_.on_error &&
StreamInfo::isStreamIdleTimeout(info)) {
// If the stream info has a response code details with a stream idle timeout, treat as error.
ENVOY_LOG(trace, "PlatformBridgeFilter({})->on_error", filter_name_);
envoy_data error_message = Data::Utility::copyToBridgeData("Stream idle timeout");
auto& info = decoder_callbacks_->streamInfo();
int32_t attempts = static_cast<int32_t>(info.attemptCount().value_or(0));
platform_filter_.on_error({ENVOY_REQUEST_TIMEOUT, error_message, attempts}, streamIntel(),
finalStreamIntel(), platform_filter_.instance_context);
} else if (!response_filter_base_->state_.stream_complete_ && platform_filter_.on_cancel) {
// If the filter chain is destroyed before a response is received, treat as cancellation.
ENVOY_LOG(trace, "PlatformBridgeFilter({})->on_cancel", filter_name_);
platform_filter_.on_cancel(streamIntel(), finalStreamIntel(),
platform_filter_.instance_context);
Expand Down
2 changes: 2 additions & 0 deletions library/common/http/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ envoy_error Client::DirectStreamCallbacks::streamError() {
if (info.responseCode().has_value()) {
error.error_code = Bridge::Utility::errorCodeFromLocalStatus(
static_cast<Http::Code>(info.responseCode().value()));
} else if (StreamInfo::isStreamIdleTimeout(info)) {
error.error_code = ENVOY_REQUEST_TIMEOUT;
} else {
error.error_code = ENVOY_STREAM_RESET;
}
Expand Down
5 changes: 5 additions & 0 deletions library/common/stream_info/extra_stream_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,10 @@ void setFinalStreamIntel(StreamInfo& stream_info, envoy_final_stream_intel& fina
final_intel.response_flags = stream_info.responseFlags();
}

bool isStreamIdleTimeout(const StreamInfo& stream_info) {
return stream_info.responseCodeDetails().has_value() &&
stream_info.responseCodeDetails().value() == ResponseCodeDetails::get().StreamIdleTimeout;
}

} // namespace StreamInfo
} // namespace Envoy
4 changes: 4 additions & 0 deletions library/common/stream_info/extra_stream_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ struct ExtraStreamInfo : public FilterState::Object {
// Set fields in final_intel based on stream_info.
void setFinalStreamIntel(StreamInfo& stream_info, envoy_final_stream_intel& final_intel);

// Returns true if the response code details indicate that this stream info
// has a stream idle timeout error.
bool isStreamIdleTimeout(const StreamInfo& stream_info);

using ExtraStreamInfoPtr = std::unique_ptr<ExtraStreamInfo>;

} // namespace StreamInfo
Expand Down

0 comments on commit 3464962

Please sign in to comment.