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

Side by Side Diff: net/quic/quic_config.cc

Issue 14411004: Land Recent QUIC Changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use CONFIG_VERSION insteaf of VERSION Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_config.h" 5 #include "net/quic/quic_config.h"
6 6
7 using std::string; 7 using std::string;
8 8
9 namespace net { 9 namespace net {
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 kICSL, static_cast<uint32>(idle_connection_state_lifetime_.ToSeconds())); 64 kICSL, static_cast<uint32>(idle_connection_state_lifetime_.ToSeconds()));
65 out->SetValue(kKATO, static_cast<uint32>(keepalive_timeout_.ToSeconds())); 65 out->SetValue(kKATO, static_cast<uint32>(keepalive_timeout_.ToSeconds()));
66 out->SetVector(kCGST, congestion_control_); 66 out->SetVector(kCGST, congestion_control_);
67 } 67 }
68 68
69 QuicErrorCode QuicConfig::ProcessFinalPeerHandshake( 69 QuicErrorCode QuicConfig::ProcessFinalPeerHandshake(
70 const CryptoHandshakeMessage& msg, 70 const CryptoHandshakeMessage& msg,
71 CryptoUtils::Priority priority, 71 CryptoUtils::Priority priority,
72 QuicNegotiatedParameters* out_params, 72 QuicNegotiatedParameters* out_params,
73 string* error_details) const { 73 string* error_details) const {
74 DCHECK(error_details != NULL);
75
74 const CryptoTag* their_congestion_controls; 76 const CryptoTag* their_congestion_controls;
75 size_t num_their_congestion_controls; 77 size_t num_their_congestion_controls;
76 QuicErrorCode error; 78 QuicErrorCode error;
77 79
78 error = msg.GetTaglist(kCGST, &their_congestion_controls, 80 error = msg.GetTaglist(kCGST, &their_congestion_controls,
79 &num_their_congestion_controls); 81 &num_their_congestion_controls);
80 if (error != QUIC_NO_ERROR) { 82 if (error != QUIC_NO_ERROR) {
81 if (error_details) { 83 *error_details = "Missing CGST";
82 *error_details = "Missing CGST";
83 }
84 return error; 84 return error;
85 } 85 }
86 86
87 if (!CryptoUtils::FindMutualTag(congestion_control_, 87 if (!CryptoUtils::FindMutualTag(congestion_control_,
88 their_congestion_controls, 88 their_congestion_controls,
89 num_their_congestion_controls, 89 num_their_congestion_controls,
90 priority, 90 priority,
91 &out_params->congestion_control, 91 &out_params->congestion_control,
92 NULL)) { 92 NULL)) {
93 if (error_details) { 93 *error_details = "Unsuported CGST";
94 *error_details = "Unsuported CGST";
95 }
96 return QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP; 94 return QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP;
97 } 95 }
98 96
99 uint32 idle; 97 uint32 idle;
100 error = msg.GetUint32(kICSL, &idle); 98 error = msg.GetUint32(kICSL, &idle);
101 if (error != QUIC_NO_ERROR) { 99 if (error != QUIC_NO_ERROR) {
102 if (error_details) { 100 *error_details = "Missing ICSL";
103 *error_details = "Missing ICSL";
104 }
105 return error; 101 return error;
106 } 102 }
107 103
108 out_params->idle_connection_state_lifetime = QuicTime::Delta::FromSeconds( 104 out_params->idle_connection_state_lifetime = QuicTime::Delta::FromSeconds(
109 std::min(static_cast<uint32>(idle_connection_state_lifetime_.ToSeconds()), 105 std::min(static_cast<uint32>(idle_connection_state_lifetime_.ToSeconds()),
110 idle)); 106 idle));
111 107
112 uint32 keepalive; 108 uint32 keepalive;
113 error = msg.GetUint32(kKATO, &keepalive); 109 error = msg.GetUint32(kKATO, &keepalive);
114 switch (error) { 110 switch (error) {
115 case QUIC_NO_ERROR: 111 case QUIC_NO_ERROR:
116 out_params->keepalive_timeout = QuicTime::Delta::FromSeconds( 112 out_params->keepalive_timeout = QuicTime::Delta::FromSeconds(
117 std::min(static_cast<uint32>(keepalive_timeout_.ToSeconds()), 113 std::min(static_cast<uint32>(keepalive_timeout_.ToSeconds()),
118 keepalive)); 114 keepalive));
119 break; 115 break;
120 case QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND: 116 case QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND:
121 // KATO is optional. 117 // KATO is optional.
122 out_params->keepalive_timeout = QuicTime::Delta::Zero(); 118 out_params->keepalive_timeout = QuicTime::Delta::Zero();
123 break; 119 break;
124 default: 120 default:
125 if (error_details) { 121 *error_details = "Bad KATO";
126 *error_details = "Bad KATO";
127 }
128 return error; 122 return error;
129 } 123 }
130 124
131 return QUIC_NO_ERROR; 125 return QUIC_NO_ERROR;
132 } 126 }
133 127
134 } // namespace net 128 } // namespace net
135 129
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698