Change number of connection attempts in QuicClientBase::Connect
This removes its dependency on GetNumSentClientHellos. Though instead of
comparing the number of connection attempts to kMaxClientHellos, it could
probably just try twice - once for whatever initial version the client is
configured for, and a second time for a new version in response to version
negotiation.
gfe-relnote: n/a (tools only change)
PiperOrigin-RevId: 295235905
Change-Id: Ia1d601bf66f61639cf45276534be122d63f5e1d3
diff --git a/quic/tools/quic_client_base.cc b/quic/tools/quic_client_base.cc
index e924c46..4b51184 100644
--- a/quic/tools/quic_client_base.cc
+++ b/quic/tools/quic_client_base.cc
@@ -72,8 +72,9 @@
bool QuicClientBase::Connect() {
// Attempt multiple connects until the maximum number of client hellos have
// been sent.
+ int num_attempts = 0;
while (!connected() &&
- GetNumSentClientHellos() <= QuicCryptoClientStream::kMaxClientHellos) {
+ num_attempts <= QuicCryptoClientStream::kMaxClientHellos) {
StartConnect();
while (EncryptionBeingEstablished()) {
WaitForEvents();
@@ -84,6 +85,7 @@
// cannot reconnect with a different version. Give up trying.
break;
}
+ num_attempts++;
}
return session()->connection()->connected();
}