Create a shared interface to access QuicTransport*Session::IsSessionReady().
Also slightly alter the logic to make sure that the session does not stop being ready when the connection is closed.
gfe-relnote: n/a (not used in production)
PiperOrigin-RevId: 274230704
Change-Id: Idfe2d0135e5f35b1974619066743cc9edf8c44a9
diff --git a/quic/quic_transport/quic_transport_client_session.cc b/quic/quic_transport/quic_transport_client_session.cc
index 5e2552f..032f61d 100644
--- a/quic/quic_transport/quic_transport_client_session.cc
+++ b/quic/quic_transport/quic_transport_client_session.cc
@@ -104,7 +104,7 @@
ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
return;
}
- if (client_indication_sent_) {
+ if (ready_) {
QUIC_BUG << "Client indication may only be sent once.";
connection()->CloseConnection(
QUIC_INTERNAL_ERROR, "Attempted to send client indication twice",
@@ -121,6 +121,13 @@
client_indication->WriteOrBufferData(SerializeClientIndication(),
/*fin=*/true, nullptr);
client_indication_sent_ = true;
+
+ // Don't set the ready bit if we closed the connection due to any error
+ // beforehand.
+ if (!connection()->connected()) {
+ return;
+ }
+ ready_ = true;
}
} // namespace quic