OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_client_session.h" | 5 #include "net/quic/quic_client_session.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/metrics/sparse_histogram.h" | 10 #include "base/metrics/sparse_histogram.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "net/udp/datagram_client_socket.h" | 27 #include "net/udp/datagram_client_socket.h" |
28 | 28 |
29 namespace net { | 29 namespace net { |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
33 // The length of time to wait for a 0-RTT handshake to complete | 33 // The length of time to wait for a 0-RTT handshake to complete |
34 // before allowing the requests to possibly proceed over TCP. | 34 // before allowing the requests to possibly proceed over TCP. |
35 const int k0RttHandshakeTimeoutMs = 300; | 35 const int k0RttHandshakeTimeoutMs = 300; |
36 | 36 |
| 37 // IPv6 packets have an additional 20 bytes of overhead than IPv4 packets. |
| 38 const size_t kAdditionalOverheadForIPv6 = 20; |
| 39 |
37 // Histograms for tracking down the crashes from http://crbug.com/354669 | 40 // Histograms for tracking down the crashes from http://crbug.com/354669 |
38 // Note: these values must be kept in sync with the corresponding values in: | 41 // Note: these values must be kept in sync with the corresponding values in: |
39 // tools/metrics/histograms/histograms.xml | 42 // tools/metrics/histograms/histograms.xml |
40 enum Location { | 43 enum Location { |
41 DESTRUCTOR = 0, | 44 DESTRUCTOR = 0, |
42 ADD_OBSERVER = 1, | 45 ADD_OBSERVER = 1, |
43 TRY_CREATE_STREAM = 2, | 46 TRY_CREATE_STREAM = 2, |
44 CREATE_OUTGOING_RELIABLE_STREAM = 3, | 47 CREATE_OUTGOING_RELIABLE_STREAM = 3, |
45 NOTIFY_FACTORY_OF_SESSION_CLOSED_LATER = 4, | 48 NOTIFY_FACTORY_OF_SESSION_CLOSED_LATER = 4, |
46 NOTIFY_FACTORY_OF_SESSION_CLOSED = 5, | 49 NOTIFY_FACTORY_OF_SESSION_CLOSED = 5, |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 server_info_(server_info.Pass()), | 166 server_info_(server_info.Pass()), |
164 read_pending_(false), | 167 read_pending_(false), |
165 num_total_streams_(0), | 168 num_total_streams_(0), |
166 task_runner_(task_runner), | 169 task_runner_(task_runner), |
167 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)), | 170 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)), |
168 logger_(new QuicConnectionLogger(this, net_log_)), | 171 logger_(new QuicConnectionLogger(this, net_log_)), |
169 num_packets_read_(0), | 172 num_packets_read_(0), |
170 going_away_(false), | 173 going_away_(false), |
171 weak_factory_(this) { | 174 weak_factory_(this) { |
172 connection->set_debug_visitor(logger_); | 175 connection->set_debug_visitor(logger_); |
| 176 IPEndPoint address; |
| 177 if (socket && socket->GetLocalAddress(&address) == OK && |
| 178 address.GetFamily() == ADDRESS_FAMILY_IPV6) { |
| 179 connection->set_max_packet_length( |
| 180 connection->max_packet_length() - kAdditionalOverheadForIPv6); |
| 181 } |
173 } | 182 } |
174 | 183 |
175 void QuicClientSession::InitializeSession( | 184 void QuicClientSession::InitializeSession( |
176 const QuicServerId& server_id, | 185 const QuicServerId& server_id, |
177 QuicCryptoClientConfig* crypto_config, | 186 QuicCryptoClientConfig* crypto_config, |
178 QuicCryptoClientStreamFactory* crypto_client_stream_factory) { | 187 QuicCryptoClientStreamFactory* crypto_client_stream_factory) { |
179 server_host_port_ = server_id.host_port_pair(); | 188 server_host_port_ = server_id.host_port_pair(); |
180 crypto_stream_.reset( | 189 crypto_stream_.reset( |
181 crypto_client_stream_factory ? | 190 crypto_client_stream_factory ? |
182 crypto_client_stream_factory->CreateQuicCryptoClientStream( | 191 crypto_client_stream_factory->CreateQuicCryptoClientStream( |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 return; | 886 return; |
878 | 887 |
879 // TODO(rch): re-enable this code once beta is cut. | 888 // TODO(rch): re-enable this code once beta is cut. |
880 // if (stream_factory_) | 889 // if (stream_factory_) |
881 // stream_factory_->OnSessionConnectTimeout(this); | 890 // stream_factory_->OnSessionConnectTimeout(this); |
882 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); | 891 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); |
883 // DCHECK_EQ(0u, GetNumOpenStreams()); | 892 // DCHECK_EQ(0u, GetNumOpenStreams()); |
884 } | 893 } |
885 | 894 |
886 } // namespace net | 895 } // namespace net |
OLD | NEW |