void Filter::onStreamMaxDurationReached(UpstreamRequest& upstream_request) {
  upstream_request.resetStream();

  if (maybeRetryReset(Http::StreamResetReason::LocalReset, upstream_request)) {
    return;
  }

  upstream_request.removeFromList(upstream_requests_);
  cleanup();

  callbacks_->streamInfo().setResponseFlag(
      StreamInfo::ResponseFlag::UpstreamMaxStreamDurationReached);
  // sendLocalReply may instead reset the stream if downstream_response_started_ is true.
  callbacks_->sendLocalReply(
      Http::Code::RequestTimeout, "upstream max stream duration reached", modify_headers_,
      absl::nullopt, StreamInfo::ResponseCodeDetails::get().UpstreamMaxStreamDurationReached);
}
void Filter::onStreamMaxDurationReached(UpstreamRequest& upstream_request) {
  upstream_request.resetStream();

  if (maybeRetryReset(Http::StreamResetReason::LocalReset, upstream_request)) {
    return;
  }

  upstream_request.removeFromList(upstream_requests_);
  cleanup();

  callbacks_->streamInfo().setResponseFlag(
      StreamInfo::ResponseFlag::UpstreamMaxStreamDurationReached);
   
  callbacks_->sendLocalReply(
      Http::Code::RequestTimeout, "upstream max stream duration reached", modify_headers_,
      absl::nullopt, StreamInfo::ResponseCodeDetails::get().UpstreamMaxStreamDurationReached);
}