Change QuicStream::CloseConnectionWithDetails() to QuicStream::OnUnrecoverableError.
The stream shouldn't be able to instruct the session on what to do. Instead, it should just report its state change and let the session handle it.
gfe-relnote: name change only. Not protected.
PiperOrigin-RevId: 294966339
Change-Id: Ibff2ed7169d0964ea5f19823445f5aa9ce8c5916
diff --git a/quic/core/http/quic_headers_stream.cc b/quic/core/http/quic_headers_stream.cc
index 5b1a87b..1bac2b7 100644
--- a/quic/core/http/quic_headers_stream.cc
+++ b/quic/core/http/quic_headers_stream.cc
@@ -85,8 +85,8 @@
if (header.unacked_length < header_length) {
QUIC_BUG << "Unsent stream data is acked. unacked_length: "
<< header.unacked_length << " acked_length: " << header_length;
- CloseConnectionWithDetails(QUIC_INTERNAL_ERROR,
- "Unsent stream data is acked");
+ OnUnrecoverableError(QUIC_INTERNAL_ERROR,
+ "Unsent stream data is acked");
return false;
}
if (header.ack_listener != nullptr && header_length > 0) {
diff --git a/quic/core/http/quic_receive_control_stream.cc b/quic/core/http/quic_receive_control_stream.cc
index ab7a55b..6e7389b 100644
--- a/quic/core/http/quic_receive_control_stream.cc
+++ b/quic/core/http/quic_receive_control_stream.cc
@@ -26,13 +26,11 @@
HttpDecoderVisitor& operator=(const HttpDecoderVisitor&) = delete;
void OnError(HttpDecoder* decoder) override {
- stream_->session()->connection()->CloseConnection(
- decoder->error(), decoder->error_detail(),
- ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
+ stream_->OnUnrecoverableError(decoder->error(), decoder->error_detail());
}
bool OnCancelPushFrame(const CancelPushFrame& /*frame*/) override {
- CloseConnectionOnWrongFrame("Cancel Push");
+ OnWrongFrame("Cancel Push");
return false;
}
@@ -41,13 +39,13 @@
stream_->spdy_session()->SetMaxAllowedPushId(frame.push_id);
return true;
}
- CloseConnectionOnWrongFrame("Max Push Id");
+ OnWrongFrame("Max Push Id");
return false;
}
bool OnGoAwayFrame(const GoAwayFrame& frame) override {
if (stream_->spdy_session()->perspective() == Perspective::IS_SERVER) {
- CloseConnectionOnWrongFrame("Go Away");
+ OnWrongFrame("Go Away");
return false;
}
stream_->spdy_session()->OnHttp3GoAway(frame.stream_id);
@@ -63,59 +61,59 @@
}
bool OnDuplicatePushFrame(const DuplicatePushFrame& /*frame*/) override {
- CloseConnectionOnWrongFrame("Duplicate Push");
+ OnWrongFrame("Duplicate Push");
return false;
}
bool OnDataFrameStart(QuicByteCount /*header_length*/) override {
- CloseConnectionOnWrongFrame("Data");
+ OnWrongFrame("Data");
return false;
}
bool OnDataFramePayload(quiche::QuicheStringPiece /*payload*/) override {
- CloseConnectionOnWrongFrame("Data");
+ OnWrongFrame("Data");
return false;
}
bool OnDataFrameEnd() override {
- CloseConnectionOnWrongFrame("Data");
+ OnWrongFrame("Data");
return false;
}
bool OnHeadersFrameStart(QuicByteCount /*header_length*/) override {
- CloseConnectionOnWrongFrame("Headers");
+ OnWrongFrame("Headers");
return false;
}
bool OnHeadersFramePayload(quiche::QuicheStringPiece /*payload*/) override {
- CloseConnectionOnWrongFrame("Headers");
+ OnWrongFrame("Headers");
return false;
}
bool OnHeadersFrameEnd() override {
- CloseConnectionOnWrongFrame("Headers");
+ OnWrongFrame("Headers");
return false;
}
bool OnPushPromiseFrameStart(QuicByteCount /*header_length*/) override {
- CloseConnectionOnWrongFrame("Push Promise");
+ OnWrongFrame("Push Promise");
return false;
}
bool OnPushPromiseFramePushId(PushId /*push_id*/,
QuicByteCount /*push_id_length*/) override {
- CloseConnectionOnWrongFrame("Push Promise");
+ OnWrongFrame("Push Promise");
return false;
}
bool OnPushPromiseFramePayload(
quiche::QuicheStringPiece /*payload*/) override {
- CloseConnectionOnWrongFrame("Push Promise");
+ OnWrongFrame("Push Promise");
return false;
}
bool OnPushPromiseFrameEnd() override {
- CloseConnectionOnWrongFrame("Push Promise");
+ OnWrongFrame("Push Promise");
return false;
}
@@ -144,8 +142,8 @@
}
private:
- void CloseConnectionOnWrongFrame(quiche::QuicheStringPiece frame_type) {
- stream_->CloseConnectionWithDetails(
+ void OnWrongFrame(quiche::QuicheStringPiece frame_type) {
+ stream_->OnUnrecoverableError(
QUIC_HTTP_FRAME_UNEXPECTED_ON_CONTROL_STREAM,
quiche::QuicheStrCat(frame_type, " frame received on control stream"));
}
diff --git a/quic/core/http/quic_spdy_stream.cc b/quic/core/http/quic_spdy_stream.cc
index 67234a9..8625dae 100644
--- a/quic/core/http/quic_spdy_stream.cc
+++ b/quic/core/http/quic_spdy_stream.cc
@@ -41,8 +41,7 @@
HttpDecoderVisitor& operator=(const HttpDecoderVisitor&) = delete;
void OnError(HttpDecoder* decoder) override {
- stream_->CloseConnectionWithDetails(decoder->error(),
- decoder->error_detail());
+ stream_->OnUnrecoverableError(decoder->error(), decoder->error_detail());
}
bool OnCancelPushFrame(const CancelPushFrame& /*frame*/) override {
@@ -169,7 +168,7 @@
private:
void CloseConnectionOnWrongFrame(quiche::QuicheStringPiece frame_type) {
- stream_->CloseConnectionWithDetails(
+ stream_->OnUnrecoverableError(
QUIC_HTTP_FRAME_UNEXPECTED_ON_SPDY_STREAM,
quiche::QuicheStrCat(frame_type, " frame received on data stream"));
}
@@ -577,8 +576,8 @@
std::string connection_close_error_message = quiche::QuicheStrCat(
"Error decoding ", headers_decompressed_ ? "trailers" : "headers",
" on stream ", id(), ": ", error_message);
- CloseConnectionWithDetails(QUIC_QPACK_DECOMPRESSION_FAILED,
- connection_close_error_message);
+ OnUnrecoverableError(QUIC_QPACK_DECOMPRESSION_FAILED,
+ connection_close_error_message);
}
void QuicSpdyStream::MaybeSendPriorityUpdateFrame() {
@@ -607,8 +606,8 @@
// or with H3_REQUEST_REJECTED (if server).
std::string error_message =
quiche::QuicheStrCat("Too large headers received on stream ", id());
- CloseConnectionWithDetails(QUIC_HEADERS_STREAM_DATA_DECOMPRESS_FAILURE,
- error_message);
+ OnUnrecoverableError(QUIC_HEADERS_STREAM_DATA_DECOMPRESS_FAILURE,
+ error_message);
} else {
Reset(QUIC_HEADERS_TOO_LARGE);
}