| 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" |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 if (enable_port_selection) { | 864 if (enable_port_selection) { |
| 865 DCHECK_LE(1u, port_suggester->call_count()); | 865 DCHECK_LE(1u, port_suggester->call_count()); |
| 866 } else { | 866 } else { |
| 867 DCHECK_EQ(0u, port_suggester->call_count()); | 867 DCHECK_EQ(0u, port_suggester->call_count()); |
| 868 } | 868 } |
| 869 | 869 |
| 870 // We should adaptively set this buffer size, but for now, we'll use a size | 870 // We should adaptively set this buffer size, but for now, we'll use a size |
| 871 // that is more than large enough for a full receive window, and yet | 871 // that is more than large enough for a full receive window, and yet |
| 872 // does not consume "too much" memory. If we see bursty packet loss, we may | 872 // does not consume "too much" memory. If we see bursty packet loss, we may |
| 873 // revisit this setting and test for its impact. | 873 // revisit this setting and test for its impact. |
| 874 const int32 kSocketBufferSize(TcpReceiver::kReceiveWindowTCP); | 874 const int32 kSocketBufferSize = |
| 875 static_cast<int32>(TcpReceiver::kReceiveWindowTCP); |
| 875 rv = socket->SetReceiveBufferSize(kSocketBufferSize); | 876 rv = socket->SetReceiveBufferSize(kSocketBufferSize); |
| 876 if (rv != OK) { | 877 if (rv != OK) { |
| 877 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_RECEIVE_BUFFER); | 878 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_RECEIVE_BUFFER); |
| 878 return rv; | 879 return rv; |
| 879 } | 880 } |
| 880 // Set a buffer large enough to contain the initial CWND's worth of packet | 881 // Set a buffer large enough to contain the initial CWND's worth of packet |
| 881 // to work around the problem with CHLO packets being sent out with the | 882 // to work around the problem with CHLO packets being sent out with the |
| 882 // wrong encryption level, when the send buffer is full. | 883 // wrong encryption level, when the send buffer is full. |
| 883 rv = socket->SetSendBufferSize(kMaxPacketSize * 20); | 884 rv = socket->SetSendBufferSize(kMaxPacketSize * 20); |
| 884 if (rv != OK) { | 885 if (rv != OK) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 QuicConfig config = config_; | 922 QuicConfig config = config_; |
| 922 config.set_max_undecryptable_packets(kMaxUndecryptablePackets); | 923 config.set_max_undecryptable_packets(kMaxUndecryptablePackets); |
| 923 config.SetInitialFlowControlWindowToSend(kInitialReceiveWindowSize); | 924 config.SetInitialFlowControlWindowToSend(kInitialReceiveWindowSize); |
| 924 config.SetInitialStreamFlowControlWindowToSend(kInitialReceiveWindowSize); | 925 config.SetInitialStreamFlowControlWindowToSend(kInitialReceiveWindowSize); |
| 925 config.SetInitialSessionFlowControlWindowToSend(kInitialReceiveWindowSize); | 926 config.SetInitialSessionFlowControlWindowToSend(kInitialReceiveWindowSize); |
| 926 if (http_server_properties_) { | 927 if (http_server_properties_) { |
| 927 const HttpServerProperties::NetworkStats* stats = | 928 const HttpServerProperties::NetworkStats* stats = |
| 928 http_server_properties_->GetServerNetworkStats( | 929 http_server_properties_->GetServerNetworkStats( |
| 929 server_id.host_port_pair()); | 930 server_id.host_port_pair()); |
| 930 if (stats != nullptr) { | 931 if (stats != nullptr) { |
| 931 config.SetInitialRoundTripTimeUsToSend(stats->srtt.InMicroseconds()); | 932 config.SetInitialRoundTripTimeUsToSend( |
| 933 static_cast<uint32>(stats->srtt.InMicroseconds())); |
| 932 } | 934 } |
| 933 } | 935 } |
| 934 | 936 |
| 935 if (quic_server_info_factory_ && !server_info) { | 937 if (quic_server_info_factory_ && !server_info) { |
| 936 // Start the disk cache loading so that we can persist the newer QUIC server | 938 // Start the disk cache loading so that we can persist the newer QUIC server |
| 937 // information and/or inform the disk cache that we have reused | 939 // information and/or inform the disk cache that we have reused |
| 938 // |server_info|. | 940 // |server_info|. |
| 939 server_info.reset(quic_server_info_factory_->GetForServer(server_id)); | 941 server_info.reset(quic_server_info_factory_->GetForServer(server_id)); |
| 940 server_info->Start(); | 942 server_info->Start(); |
| 941 } | 943 } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 http_server_properties_->ClearAlternateProtocol(server); | 1076 http_server_properties_->ClearAlternateProtocol(server); |
| 1075 http_server_properties_->SetAlternateProtocol( | 1077 http_server_properties_->SetAlternateProtocol( |
| 1076 server, alternate.port, alternate.protocol, 1); | 1078 server, alternate.port, alternate.protocol, 1); |
| 1077 DCHECK_EQ(QUIC, | 1079 DCHECK_EQ(QUIC, |
| 1078 http_server_properties_->GetAlternateProtocol(server).protocol); | 1080 http_server_properties_->GetAlternateProtocol(server).protocol); |
| 1079 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( | 1081 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( |
| 1080 server)); | 1082 server)); |
| 1081 } | 1083 } |
| 1082 | 1084 |
| 1083 } // namespace net | 1085 } // namespace net |
| OLD | NEW |