Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Unified Diff: net/quic/quic_crypto_client_stream.cc

Issue 391383002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merging with TOT Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_crypto_client_stream.h ('k') | net/quic/quic_crypto_client_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 19f3cec25bb014b526163e894ce0537d835c31a0..64cb9502bc59af26e57b50f3d300562e4de547a9 100644
--- a/net/quic/quic_crypto_client_stream.cc
+++ b/net/quic/quic_crypto_client_stream.cc
@@ -95,8 +95,28 @@ QuicCryptoClientStream::~QuicCryptoClientStream() {
void QuicCryptoClientStream::OnHandshakeMessage(
const CryptoHandshakeMessage& message) {
+ DVLOG(1) << "Client: Received " << message.DebugString();
+
QuicCryptoStream::OnHandshakeMessage(message);
+ if (message.tag() == kSCUP) {
+ if (!handshake_confirmed()) {
+ CloseConnection(QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE);
+ return;
+ }
+
+ // |message| is an update from the server, so we treat it differently from a
+ // handshake message.
+ HandleServerConfigUpdateMessage(&message);
+ return;
+ }
+
+ // Do not process handshake messages after the handshake is confirmed.
+ if (handshake_confirmed()) {
+ CloseConnection(QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE);
+ return;
+ }
+
DoHandshakeLoop(&message);
}
@@ -114,6 +134,26 @@ bool QuicCryptoClientStream::WasChannelIDSent() const {
return channel_id_sent_;
}
+void QuicCryptoClientStream::HandleServerConfigUpdateMessage(
+ const CryptoHandshakeMessage* in) {
+ DCHECK(in->tag() == kSCUP);
+ string error_details;
+ QuicCryptoClientConfig::CachedState* cached =
+ crypto_config_->LookupOrCreate(server_id_);
+ QuicErrorCode error = crypto_config_->ProcessServerConfigUpdate(
+ *in,
+ session()->connection()->clock()->WallNow(),
+ cached,
+ &crypto_negotiated_params_,
+ &error_details);
+
+ if (error != QUIC_NO_ERROR) {
+ CloseConnectionWithDetails(
+ error, "Server config update invalid: " + error_details);
+ return;
+ }
+}
+
// kMaxClientHellos is the maximum number of times that we'll send a client
// hello. The value 3 accounts for:
// * One failure due to an incorrect or missing source-address token.
@@ -129,10 +169,6 @@ void QuicCryptoClientStream::DoHandshakeLoop(
QuicCryptoClientConfig::CachedState* cached =
crypto_config_->LookupOrCreate(server_id_);
- if (in != NULL) {
- DVLOG(1) << "Client: Received " << in->DebugString();
- }
-
for (;;) {
const State state = next_state_;
next_state_ = STATE_IDLE;
« no previous file with comments | « net/quic/quic_crypto_client_stream.h ('k') | net/quic/quic_crypto_client_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698