OLD | NEW |
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 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "net/quic/crypto/crypto_handshake_message.h" | 10 #include "net/quic/crypto/crypto_handshake_message.h" |
11 #include "net/quic/crypto/crypto_protocol.h" | 11 #include "net/quic/crypto/crypto_protocol.h" |
12 #include "net/quic/quic_sent_packet_manager.h" | 12 #include "net/quic/quic_sent_packet_manager.h" |
13 #include "net/quic/quic_utils.h" | 13 #include "net/quic/quic_utils.h" |
14 | 14 |
| 15 using std::min; |
15 using std::string; | 16 using std::string; |
16 | 17 |
17 namespace net { | 18 namespace net { |
18 | 19 |
19 // Reads the value corresponding to |name_| from |msg| into |out|. If the | 20 // Reads the value corresponding to |name_| from |msg| into |out|. If the |
20 // |name_| is absent in |msg| and |presence| is set to OPTIONAL |out| is set | 21 // |name_| is absent in |msg| and |presence| is set to OPTIONAL |out| is set |
21 // to |default_value|. | 22 // to |default_value|. |
22 QuicErrorCode ReadUint32(const CryptoHandshakeMessage& msg, | 23 QuicErrorCode ReadUint32(const CryptoHandshakeMessage& msg, |
23 QuicTag tag, | 24 QuicTag tag, |
24 QuicConfigPresence presence, | 25 QuicConfigPresence presence, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 QuicErrorCode error = ReadUint32(client_hello, | 100 QuicErrorCode error = ReadUint32(client_hello, |
100 tag_, | 101 tag_, |
101 presence_, | 102 presence_, |
102 default_value_, | 103 default_value_, |
103 &value, | 104 &value, |
104 error_details); | 105 error_details); |
105 if (error != QUIC_NO_ERROR) { | 106 if (error != QUIC_NO_ERROR) { |
106 return error; | 107 return error; |
107 } | 108 } |
108 negotiated_ = true; | 109 negotiated_ = true; |
109 negotiated_value_ = std::min(value, max_value_); | 110 negotiated_value_ = min(value, max_value_); |
110 | 111 |
111 return QUIC_NO_ERROR; | 112 return QUIC_NO_ERROR; |
112 } | 113 } |
113 | 114 |
114 QuicErrorCode QuicNegotiableUint32::ProcessServerHello( | 115 QuicErrorCode QuicNegotiableUint32::ProcessServerHello( |
115 const CryptoHandshakeMessage& server_hello, | 116 const CryptoHandshakeMessage& server_hello, |
116 string* error_details) { | 117 string* error_details) { |
117 DCHECK(!negotiated_); | 118 DCHECK(!negotiated_); |
118 DCHECK(error_details != NULL); | 119 DCHECK(error_details != NULL); |
119 uint32 value; | 120 uint32 value; |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 server_hello, error_details); | 501 server_hello, error_details); |
501 } | 502 } |
502 if (error == QUIC_NO_ERROR) { | 503 if (error == QUIC_NO_ERROR) { |
503 error = peer_initial_flow_control_window_bytes_.ProcessServerHello( | 504 error = peer_initial_flow_control_window_bytes_.ProcessServerHello( |
504 server_hello, error_details); | 505 server_hello, error_details); |
505 } | 506 } |
506 return error; | 507 return error; |
507 } | 508 } |
508 | 509 |
509 } // namespace net | 510 } // namespace net |
OLD | NEW |