Index: net/quic/quic_crypto_client_stream.cc |
diff --git a/net/quic/quic_crypto_client_stream.cc b/net/quic/quic_crypto_client_stream.cc |
index 3e5f84059fc0ec4567c39d1da66a18f7c3f5299c..1de80213bf0f0cce744db60cfc75c0e10caf938a 100644 |
--- a/net/quic/quic_crypto_client_stream.cc |
+++ b/net/quic/quic_crypto_client_stream.cc |
@@ -11,6 +11,7 @@ |
#include "net/quic/crypto/null_encrypter.h" |
#include "net/quic/crypto/proof_verifier.h" |
#include "net/quic/crypto/proof_verifier_chromium.h" |
+#include "net/quic/crypto/quic_server_info.h" |
#include "net/quic/quic_protocol.h" |
#include "net/quic/quic_session.h" |
#include "net/ssl/ssl_connection_status_flags.h" |
@@ -91,7 +92,7 @@ void QuicCryptoClientStream::OnHandshakeMessage( |
} |
bool QuicCryptoClientStream::CryptoConnect() { |
- next_state_ = STATE_SEND_CHLO; |
+ next_state_ = STATE_LOAD_QUIC_SERVER_INFO; |
DoHandshakeLoop(NULL); |
return true; |
} |
@@ -159,6 +160,12 @@ void QuicCryptoClientStream::DoHandshakeLoop( |
const State state = next_state_; |
next_state_ = STATE_IDLE; |
switch (state) { |
+ case STATE_LOAD_QUIC_SERVER_INFO: { |
+ if (DoLoadQuicServerInfo(cached) == ERR_IO_PENDING) { |
+ return; |
+ } |
+ break; |
+ } |
case STATE_SEND_CHLO: { |
// Send the client hello in plaintext. |
session()->connection()->SetDefaultEncryptionLevel(ENCRYPTION_NONE); |
@@ -166,6 +173,11 @@ void QuicCryptoClientStream::DoHandshakeLoop( |
CloseConnection(QUIC_CRYPTO_TOO_MANY_REJECTS); |
return; |
} |
+ if (!cached->proof_valid() && crypto_config_->proof_verifier() && |
+ !cached->signature().empty()) { |
+ next_state_ = STATE_VERIFY_PROOF; |
+ break; |
+ } |
wtc
2014/02/07 00:54:11
I think this should look like lines 274-283. In pa
ramant (doing other things)
2014/02/07 20:30:51
Done.
|
num_client_hellos_++; |
if (!cached->IsComplete(session()->connection()->clock()->WallNow())) { |
@@ -318,6 +330,7 @@ void QuicCryptoClientStream::DoHandshakeLoop( |
} else { |
cached->SetProofValid(); |
cached->SetProofVerifyDetails(verify_details_.release()); |
+ cached->SaveQuicServerInfo(); |
wtc
2014/02/07 00:54:11
This can be refined. We only need to call cached->
ramant (doing other things)
2014/02/07 20:30:51
ACK (and changed the code).
We set need_to_persis
|
next_state_ = STATE_SEND_CHLO; |
} |
break; |
@@ -394,4 +407,33 @@ void QuicCryptoClientStream::DoHandshakeLoop( |
} |
} |
+void QuicCryptoClientStream::OnIOComplete(int result) { |
+ DCHECK_EQ(STATE_LOAD_QUIC_SERVER_INFO, next_state_); |
+ DoHandshakeLoop(NULL); |
+} |
+ |
+int QuicCryptoClientStream::DoLoadQuicServerInfo( |
wtc
2014/02/07 00:54:11
This function should be split into two state: STAT
ramant (doing other things)
2014/02/07 20:30:51
Done.
|
+ QuicCryptoClientConfig::CachedState* cached) { |
+ next_state_ = STATE_SEND_CHLO; |
+ QuicServerInfo* quic_server_info = cached->quic_server_info(); |
+ if (!quic_server_info) { |
+ return OK; |
+ } |
+ |
+ int rv = quic_server_info->WaitForDataReady( |
+ base::Bind(&QuicCryptoClientStream::OnIOComplete, |
+ base::Unretained(this))); |
+ |
+ if (rv != OK) { |
+ if (rv == ERR_IO_PENDING) { |
+ next_state_ = STATE_LOAD_QUIC_SERVER_INFO; |
+ } |
+ return rv; |
wtc
2014/02/07 00:54:11
We may want to return OK in this case. We should a
ramant (doing other things)
2014/02/07 20:30:51
Done.
|
+ } |
+ |
+ cached->LoadQuicServerInfo(); |
+ |
+ return rv; |
+} |
+ |
} // namespace net |