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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // The suggested initial congestion windows for a server to use. | 63 // The suggested initial congestion windows for a server to use. |
64 // TODO: This should be tested and optimized, and even better, suggest a window | 64 // TODO: This should be tested and optimized, and even better, suggest a window |
65 // that corresponds to historical bandwidth and min-RTT. | 65 // that corresponds to historical bandwidth and min-RTT. |
66 // Larger initial congestion windows can, if we don't overshoot, reduce latency | 66 // Larger initial congestion windows can, if we don't overshoot, reduce latency |
67 // by avoiding the RTT needed for slow start to double (and re-double) from a | 67 // by avoiding the RTT needed for slow start to double (and re-double) from a |
68 // default of 10. | 68 // default of 10. |
69 // We match SPDY's use of 32 when secure (since we'd compete with SPDY). | 69 // We match SPDY's use of 32 when secure (since we'd compete with SPDY). |
70 const int32 kServerSecureInitialCongestionWindow = 32; | 70 const int32 kServerSecureInitialCongestionWindow = 32; |
71 // Be conservative, and just use double a typical TCP ICWND for HTTP. | 71 // Be conservative, and just use double a typical TCP ICWND for HTTP. |
72 const int32 kServerInecureInitialCongestionWindow = 20; | 72 const int32 kServerInecureInitialCongestionWindow = 20; |
| 73 // Set the maximum number of undecryptable packets the connection will store. |
| 74 const int32 kMaxUndecryptablePackets = 100; |
73 | 75 |
74 const char kDummyHostname[] = "quic.global.props"; | 76 const char kDummyHostname[] = "quic.global.props"; |
75 const uint16 kDummyPort = 0; | 77 const uint16 kDummyPort = 0; |
76 | 78 |
77 void HistogramCreateSessionFailure(enum CreateSessionFailure error) { | 79 void HistogramCreateSessionFailure(enum CreateSessionFailure error) { |
78 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.CreationError", error, | 80 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.CreationError", error, |
79 CREATION_ERROR_MAX); | 81 CREATION_ERROR_MAX); |
80 } | 82 } |
81 | 83 |
82 bool IsEcdsaSupported() { | 84 bool IsEcdsaSupported() { |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 false /* is_server */, | 897 false /* is_server */, |
896 supported_versions_); | 898 supported_versions_); |
897 connection->set_max_packet_length(max_packet_length_); | 899 connection->set_max_packet_length(max_packet_length_); |
898 | 900 |
899 InitializeCachedStateInCryptoConfig(server_id, server_info); | 901 InitializeCachedStateInCryptoConfig(server_id, server_info); |
900 | 902 |
901 QuicConfig config = config_; | 903 QuicConfig config = config_; |
902 config.SetInitialCongestionWindowToSend( | 904 config.SetInitialCongestionWindowToSend( |
903 server_id.is_https() ? kServerSecureInitialCongestionWindow | 905 server_id.is_https() ? kServerSecureInitialCongestionWindow |
904 : kServerInecureInitialCongestionWindow); | 906 : kServerInecureInitialCongestionWindow); |
| 907 config.set_max_undecryptable_packets(kMaxUndecryptablePackets); |
905 config.SetInitialFlowControlWindowToSend(kInitialReceiveWindowSize); | 908 config.SetInitialFlowControlWindowToSend(kInitialReceiveWindowSize); |
906 config.SetInitialStreamFlowControlWindowToSend(kInitialReceiveWindowSize); | 909 config.SetInitialStreamFlowControlWindowToSend(kInitialReceiveWindowSize); |
907 config.SetInitialSessionFlowControlWindowToSend(kInitialReceiveWindowSize); | 910 config.SetInitialSessionFlowControlWindowToSend(kInitialReceiveWindowSize); |
908 if (http_server_properties_) { | 911 if (http_server_properties_) { |
909 const HttpServerProperties::NetworkStats* stats = | 912 const HttpServerProperties::NetworkStats* stats = |
910 http_server_properties_->GetServerNetworkStats( | 913 http_server_properties_->GetServerNetworkStats( |
911 server_id.host_port_pair()); | 914 server_id.host_port_pair()); |
912 if (stats != nullptr) { | 915 if (stats != nullptr) { |
913 config.SetInitialRoundTripTimeUsToSend(stats->srtt.InMicroseconds()); | 916 config.SetInitialRoundTripTimeUsToSend(stats->srtt.InMicroseconds()); |
914 } | 917 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 http_server_properties_->ClearAlternateProtocol(server); | 1028 http_server_properties_->ClearAlternateProtocol(server); |
1026 http_server_properties_->SetAlternateProtocol( | 1029 http_server_properties_->SetAlternateProtocol( |
1027 server, alternate.port, alternate.protocol, 1); | 1030 server, alternate.port, alternate.protocol, 1); |
1028 DCHECK_EQ(QUIC, | 1031 DCHECK_EQ(QUIC, |
1029 http_server_properties_->GetAlternateProtocol(server).protocol); | 1032 http_server_properties_->GetAlternateProtocol(server).protocol); |
1030 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( | 1033 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( |
1031 server)); | 1034 server)); |
1032 } | 1035 } |
1033 | 1036 |
1034 } // namespace net | 1037 } // namespace net |
OLD | NEW |