| 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_stream_factory.h" | 5 #include "net/quic/quic_stream_factory.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/cpu.h" | 9 #include "base/cpu.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
| 12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/profiler/scoped_tracker.h" | 14 #include "base/profiler/scoped_tracker.h" |
| 15 #include "base/rand_util.h" | 15 #include "base/rand_util.h" |
| 16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/values.h" | 18 #include "base/values.h" |
| 19 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
| 20 #include "net/cert/cert_verifier.h" | 20 #include "net/cert/cert_verifier.h" |
| 21 #include "net/dns/host_resolver.h" | 21 #include "net/dns/host_resolver.h" |
| 22 #include "net/dns/single_request_host_resolver.h" | 22 #include "net/dns/single_request_host_resolver.h" |
| 23 #include "net/http/http_server_properties.h" | 23 #include "net/http/http_server_properties.h" |
| 24 #include "net/quic/congestion_control/tcp_receiver.h" | |
| 25 #include "net/quic/crypto/channel_id_chromium.h" | 24 #include "net/quic/crypto/channel_id_chromium.h" |
| 26 #include "net/quic/crypto/proof_verifier_chromium.h" | 25 #include "net/quic/crypto/proof_verifier_chromium.h" |
| 27 #include "net/quic/crypto/quic_random.h" | 26 #include "net/quic/crypto/quic_random.h" |
| 28 #include "net/quic/crypto/quic_server_info.h" | 27 #include "net/quic/crypto/quic_server_info.h" |
| 29 #include "net/quic/port_suggester.h" | 28 #include "net/quic/port_suggester.h" |
| 30 #include "net/quic/quic_client_session.h" | 29 #include "net/quic/quic_client_session.h" |
| 31 #include "net/quic/quic_clock.h" | 30 #include "net/quic/quic_clock.h" |
| 32 #include "net/quic/quic_connection.h" | 31 #include "net/quic/quic_connection.h" |
| 33 #include "net/quic/quic_connection_helper.h" | 32 #include "net/quic/quic_connection_helper.h" |
| 34 #include "net/quic/quic_crypto_client_stream_factory.h" | 33 #include "net/quic/quic_crypto_client_stream_factory.h" |
| (...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 DCHECK_LE(1u, port_suggester->call_count()); | 1031 DCHECK_LE(1u, port_suggester->call_count()); |
| 1033 } else { | 1032 } else { |
| 1034 DCHECK_EQ(0u, port_suggester->call_count()); | 1033 DCHECK_EQ(0u, port_suggester->call_count()); |
| 1035 } | 1034 } |
| 1036 | 1035 |
| 1037 // We should adaptively set this buffer size, but for now, we'll use a size | 1036 // We should adaptively set this buffer size, but for now, we'll use a size |
| 1038 // that is more than large enough for a full receive window, and yet | 1037 // that is more than large enough for a full receive window, and yet |
| 1039 // does not consume "too much" memory. If we see bursty packet loss, we may | 1038 // does not consume "too much" memory. If we see bursty packet loss, we may |
| 1040 // revisit this setting and test for its impact. | 1039 // revisit this setting and test for its impact. |
| 1041 const int32 kSocketBufferSize = | 1040 const int32 kSocketBufferSize = |
| 1042 static_cast<int32>(TcpReceiver::kReceiveWindowTCP); | 1041 static_cast<int32>(kDefaultSocketReceiveBuffer); |
| 1043 rv = socket->SetReceiveBufferSize(kSocketBufferSize); | 1042 rv = socket->SetReceiveBufferSize(kSocketBufferSize); |
| 1044 if (rv != OK) { | 1043 if (rv != OK) { |
| 1045 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_RECEIVE_BUFFER); | 1044 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_RECEIVE_BUFFER); |
| 1046 return rv; | 1045 return rv; |
| 1047 } | 1046 } |
| 1048 // Set a buffer large enough to contain the initial CWND's worth of packet | 1047 // Set a buffer large enough to contain the initial CWND's worth of packet |
| 1049 // to work around the problem with CHLO packets being sent out with the | 1048 // to work around the problem with CHLO packets being sent out with the |
| 1050 // wrong encryption level, when the send buffer is full. | 1049 // wrong encryption level, when the send buffer is full. |
| 1051 rv = socket->SetSendBufferSize(kMaxPacketSize * 20); | 1050 rv = socket->SetSendBufferSize(kMaxPacketSize * 20); |
| 1052 if (rv != OK) { | 1051 if (rv != OK) { |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 http_server_properties_->ClearAlternateProtocol(server); | 1334 http_server_properties_->ClearAlternateProtocol(server); |
| 1336 http_server_properties_->SetAlternateProtocol( | 1335 http_server_properties_->SetAlternateProtocol( |
| 1337 server, alternate.port, alternate.protocol, 1); | 1336 server, alternate.port, alternate.protocol, 1); |
| 1338 DCHECK_EQ(QUIC, | 1337 DCHECK_EQ(QUIC, |
| 1339 http_server_properties_->GetAlternateProtocol(server).protocol); | 1338 http_server_properties_->GetAlternateProtocol(server).protocol); |
| 1340 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( | 1339 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( |
| 1341 server)); | 1340 server)); |
| 1342 } | 1341 } |
| 1343 | 1342 |
| 1344 } // namespace net | 1343 } // namespace net |
| OLD | NEW |