Prevent QUIC streams from closing the connection directly.
Instead the error is passed through a delegate to the QUIC session to handle.
gfe-relnote: no behavior change. not protected.
PiperOrigin-RevId: 294729094
Change-Id: I4f0fc7b4ddbcd34ddf549ae4d053cbcc78535987
diff --git a/quic/core/quic_stream.cc b/quic/core/quic_stream.cc
index f2c7c88..9d8407a 100644
--- a/quic/core/quic_stream.cc
+++ b/quic/core/quic_stream.cc
@@ -112,6 +112,7 @@
PendingStream::PendingStream(QuicStreamId id, QuicSession* session)
: id_(id),
session_(session),
+ stream_delegate_(session),
stream_bytes_read_(0),
fin_received_(false),
connection_flow_controller_(session->flow_controller()),
@@ -151,8 +152,7 @@
void PendingStream::CloseConnectionWithDetails(QuicErrorCode error,
const std::string& details) {
- session_->connection()->CloseConnection(
- error, details, ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
+ stream_delegate_->OnStreamError(error, details);
}
QuicStreamId PendingStream::id() const {
@@ -337,6 +337,7 @@
: sequencer_(std::move(sequencer)),
id_(id),
session_(session),
+ stream_delegate_(session),
precedence_(CalculateDefaultPriority(session)),
stream_bytes_read_(stream_bytes_read),
stream_error_(QUIC_STREAM_NO_ERROR),
@@ -550,8 +551,7 @@
void QuicStream::CloseConnectionWithDetails(QuicErrorCode error,
const std::string& details) {
- session()->connection()->CloseConnection(
- error, details, ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
+ stream_delegate_->OnStreamError(error, details);
}
const spdy::SpdyStreamPrecedence& QuicStream::precedence() const {