Use detailed error code when client cached 0-RTT stream/flow control limit is reduced by server.

Protected by quic_enable_zero_rtt_for_tls

PiperOrigin-RevId: 316531305
Change-Id: Ia9bf39307b4e19b345605cbd8a13ed4874e7b3b8
diff --git a/quic/core/quic_stream.cc b/quic/core/quic_stream.cc
index 895cf4c..9903781 100644
--- a/quic/core/quic_stream.cc
+++ b/quic/core/quic_stream.cc
@@ -929,16 +929,11 @@
              << "ConfigSendWindowOffset called on stream without flow control";
     return false;
   }
-  if (perspective_ == Perspective::IS_CLIENT &&
-      session()->version().AllowsLowFlowControlLimits() &&
-      new_offset < flow_controller_->send_window_offset()) {
-    OnUnrecoverableError(
-        QUIC_FLOW_CONTROL_INVALID_WINDOW,
-        quiche::QuicheStrCat("New stream max data ", new_offset,
-                             " decreases current limit: ",
-                             flow_controller_->send_window_offset()));
-    return false;
-  }
+
+  QUIC_BUG_IF(session()->version().AllowsLowFlowControlLimits() &&
+              new_offset < flow_controller_->send_window_offset())
+      << ENDPOINT << "The new offset " << new_offset
+      << " decreases current offset " << flow_controller_->send_window_offset();
   if (flow_controller_->UpdateSendWindowOffset(new_offset)) {
     // Let session unblock this stream.
     session_->MarkConnectionLevelWriteBlocked(id_);
@@ -1285,6 +1280,22 @@
   session_->SendStopSending(code, id_);
 }
 
+QuicFlowController* QuicStream::flow_controller() {
+  if (flow_controller_.has_value()) {
+    return &flow_controller_.value();
+  }
+  QUIC_BUG << "Trying to access non-existent flow controller.";
+  return nullptr;
+}
+
+const QuicFlowController* QuicStream::flow_controller() const {
+  if (flow_controller_.has_value()) {
+    return &flow_controller_.value();
+  }
+  QUIC_BUG << "Trying to access non-existent flow controller.";
+  return nullptr;
+}
+
 // static
 spdy::SpdyStreamPrecedence QuicStream::CalculateDefaultPriority(
     const QuicSession* session) {