Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thrift proxy: add comments explaining local replies #14754

Merged
merged 2 commits into from
Jan 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions source/extensions/filters/network/thrift_proxy/conn_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,26 @@ FilterStatus ConnectionManager::ActiveRpc::applyDecoderFilters(ActiveRpcDecoderF
for (; entry != decoder_filters_.end(); entry++) {
const FilterStatus status = filter_action_((*entry)->handle_.get());
if (local_response_sent_) {
// The filter called sendLocalReply: stop processing filters and return
// FilterStatus::Continue irrespective of the current result.
// The filter called sendLocalReply but _did not_ close the connection.
// We return FilterStatus::Continue irrespective of the current result,
// which is fine because subsequent calls to this method will skip
// filters anyway.
//
// Note: we need to return FilterStatus::Continue here, in order for decoding
// to proceed. This is important because as noted above, the connection remains
// open so we need to consume the remaining bytes.
break;
}

if (status != FilterStatus::Continue) {
// If we got FilterStatus::StopIteration and a local reply happened but
// local_response_sent_ was not set, the connection was closed.
//
// In this case, either resetAllRpcs() gets called via onEvent(LocalClose) or
// dispatch() stops the processing.
//
// In other words, after a local reply closes the connection and StopIteration
// is returned we are done.
return status;
}
}
Expand Down