diff --git a/source/extensions/filters/network/thrift_proxy/conn_manager.cc b/source/extensions/filters/network/thrift_proxy/conn_manager.cc index 7f7129715edf..4d4b84f5b393 100644 --- a/source/extensions/filters/network/thrift_proxy/conn_manager.cc +++ b/source/extensions/filters/network/thrift_proxy/conn_manager.cc @@ -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 happend 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; } }