Add methods to QuicCryptoClientStreamBase to replace num_sent_client_hellos
The use of num_sent_client_hellos is to determine whether a 0-RTT handshake
was done (in which case it is 1) and whether an inchoate REJ was received
in the handshake (in which case it is 3). However, those only work for QUIC
crypto. To make the intention of its use clear and to make it easier to
replace QUIC crypto with TLS, the num_sent_client_hellos method is replaced
with EarlyDataAccepted and ReceivedInchoateReject.
gfe-relnote: no behavior change: adding unused methods
PiperOrigin-RevId: 294307567
Change-Id: I270cab9f702c66dbec6519a68965703a7872b87f
diff --git a/quic/qbone/qbone_client.cc b/quic/qbone/qbone_client.cc
index 2b1f7e4..a2ba117 100644
--- a/quic/qbone/qbone_client.cc
+++ b/quic/qbone/qbone_client.cc
@@ -62,6 +62,14 @@
qbone_session()->ProcessPacketFromNetwork(packet);
}
+bool QboneClient::EarlyDataAccepted() {
+ return qbone_session()->EarlyDataAccepted();
+}
+
+bool QboneClient::ReceivedInchoateReject() {
+ return qbone_session()->ReceivedInchoateReject();
+}
+
int QboneClient::GetNumSentClientHellosFromSession() {
return qbone_session()->GetNumSentClientHellos();
}
diff --git a/quic/qbone/qbone_client.h b/quic/qbone/qbone_client.h
index 2a27ddc..d415e71 100644
--- a/quic/qbone/qbone_client.h
+++ b/quic/qbone/qbone_client.h
@@ -36,6 +36,9 @@
// sends the packet down to the QBONE connection.
void ProcessPacketFromNetwork(quiche::QuicheStringPiece packet) override;
+ bool EarlyDataAccepted() override;
+ bool ReceivedInchoateReject() override;
+
protected:
int GetNumSentClientHellosFromSession() override;
int GetNumReceivedServerConfigUpdatesFromSession() override;
diff --git a/quic/qbone/qbone_client_session.cc b/quic/qbone/qbone_client_session.cc
index 024cb4a..13f8b5f 100644
--- a/quic/qbone/qbone_client_session.cc
+++ b/quic/qbone/qbone_client_session.cc
@@ -53,6 +53,16 @@
->num_sent_client_hellos();
}
+bool QboneClientSession::EarlyDataAccepted() const {
+ return static_cast<const QuicCryptoClientStreamBase*>(GetCryptoStream())
+ ->EarlyDataAccepted();
+}
+
+bool QboneClientSession::ReceivedInchoateReject() const {
+ return static_cast<const QuicCryptoClientStreamBase*>(GetCryptoStream())
+ ->ReceivedInchoateReject();
+}
+
int QboneClientSession::GetNumReceivedServerConfigUpdates() const {
return static_cast<const QuicCryptoClientStreamBase*>(GetCryptoStream())
->num_scup_messages_received();
diff --git a/quic/qbone/qbone_client_session.h b/quic/qbone/qbone_client_session.h
index c3dabe9..4eeb7b1 100644
--- a/quic/qbone/qbone_client_session.h
+++ b/quic/qbone/qbone_client_session.h
@@ -38,6 +38,19 @@
// crypto stream. If the handshake has completed then this is one greater
// than the number of round-trips needed for the handshake.
int GetNumSentClientHellos() const;
+
+ // Returns true if early data (0-RTT data) was sent and the server accepted
+ // it.
+ bool EarlyDataAccepted() const;
+
+ // Returns true if the handshake was delayed one round trip by the server
+ // because the server wanted proof the client controls its source address
+ // before progressing further. In Google QUIC, this would be due to an
+ // inchoate REJ in the QUIC Crypto handshake; in IETF QUIC this would be due
+ // to a Retry packet.
+ // TODO(nharper): Consider a better name for this method.
+ bool ReceivedInchoateReject() const;
+
int GetNumReceivedServerConfigUpdates() const;
bool SendServerRequest(const QboneServerRequest& request);