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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 enum CreateSessionFailure { | 49 enum CreateSessionFailure { |
50 CREATION_ERROR_CONNECTING_SOCKET, | 50 CREATION_ERROR_CONNECTING_SOCKET, |
51 CREATION_ERROR_SETTING_RECEIVE_BUFFER, | 51 CREATION_ERROR_SETTING_RECEIVE_BUFFER, |
52 CREATION_ERROR_SETTING_SEND_BUFFER, | 52 CREATION_ERROR_SETTING_SEND_BUFFER, |
53 CREATION_ERROR_MAX | 53 CREATION_ERROR_MAX |
54 }; | 54 }; |
55 | 55 |
56 // The initial receive window size for both streams and sessions. | 56 // The initial receive window size for both streams and sessions. |
57 const int32 kInitialReceiveWindowSize = 10 * 1024 * 1024; // 10MB | 57 const int32 kInitialReceiveWindowSize = 10 * 1024 * 1024; // 10MB |
58 | 58 |
59 // The suggested initial congestion windows for a server to use. | |
60 // TODO: This should be tested and optimized, and even better, suggest a window | |
61 // that corresponds to historical bandwidth and min-RTT. | |
62 // Larger initial congestion windows can, if we don't overshoot, reduce latency | |
63 // by avoiding the RTT needed for slow start to double (and re-double) from a | |
64 // default of 10. | |
65 // We match SPDY's use of 32 when secure (since we'd compete with SPDY). | |
66 const int32 kServerSecureInitialCongestionWindow = 32; | |
67 // Be conservative, and just use double a typical TCP ICWND for HTTP. | |
68 const int32 kServerInecureInitialCongestionWindow = 20; | |
69 | |
59 void HistogramCreateSessionFailure(enum CreateSessionFailure error) { | 70 void HistogramCreateSessionFailure(enum CreateSessionFailure error) { |
60 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.CreationError", error, | 71 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.CreationError", error, |
61 CREATION_ERROR_MAX); | 72 CREATION_ERROR_MAX); |
62 } | 73 } |
63 | 74 |
64 bool IsEcdsaSupported() { | 75 bool IsEcdsaSupported() { |
65 #if defined(OS_WIN) | 76 #if defined(OS_WIN) |
66 if (base::win::GetVersion() < base::win::VERSION_VISTA) | 77 if (base::win::GetVersion() < base::win::VERSION_VISTA) |
67 return false; | 78 return false; |
68 #endif | 79 #endif |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
736 | 747 |
737 QuicConnection* connection = | 748 QuicConnection* connection = |
738 new QuicConnection(connection_id, addr, helper_.get(), writer.get(), | 749 new QuicConnection(connection_id, addr, helper_.get(), writer.get(), |
739 false, supported_versions_, kInitialReceiveWindowSize); | 750 false, supported_versions_, kInitialReceiveWindowSize); |
740 writer->SetConnection(connection); | 751 writer->SetConnection(connection); |
741 connection->options()->max_packet_length = max_packet_length_; | 752 connection->options()->max_packet_length = max_packet_length_; |
742 | 753 |
743 InitializeCachedStateInCryptoConfig(server_id, server_info); | 754 InitializeCachedStateInCryptoConfig(server_id, server_info); |
744 | 755 |
745 QuicConfig config = config_; | 756 QuicConfig config = config_; |
757 config_.SetInitialCongestionWindowToSend( | |
758 server_id.is_https() ? kServerSecureInitialCongestionWindow | |
759 : kServerInecureInitialCongestionWindow); | |
760 if (server_id.is_https()) | |
Ryan Hamilton
2014/05/16 19:53:38
It this line a typo?
jar (doing other things)
2014/05/16 21:03:22
Yes... typo indeed. Removed. Thanks!
| |
746 if (http_server_properties_) { | 761 if (http_server_properties_) { |
747 const HttpServerProperties::NetworkStats* stats = | 762 const HttpServerProperties::NetworkStats* stats = |
748 http_server_properties_->GetServerNetworkStats( | 763 http_server_properties_->GetServerNetworkStats( |
749 server_id.host_port_pair()); | 764 server_id.host_port_pair()); |
750 if (stats != NULL) { | 765 if (stats != NULL) { |
751 config.SetInitialRoundTripTimeUsToSend(stats->srtt.InMicroseconds()); | 766 config.SetInitialRoundTripTimeUsToSend(stats->srtt.InMicroseconds()); |
752 } | 767 } |
753 } | 768 } |
754 | 769 |
755 *session = new QuicClientSession( | 770 *session = new QuicClientSession( |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
822 } | 837 } |
823 | 838 |
824 HttpServerProperties::NetworkStats network_stats; | 839 HttpServerProperties::NetworkStats network_stats; |
825 network_stats.srtt = base::TimeDelta::FromMicroseconds(stats.srtt_us); | 840 network_stats.srtt = base::TimeDelta::FromMicroseconds(stats.srtt_us); |
826 network_stats.bandwidth_estimate = stats.estimated_bandwidth; | 841 network_stats.bandwidth_estimate = stats.estimated_bandwidth; |
827 http_server_properties_->SetServerNetworkStats(server_id.host_port_pair(), | 842 http_server_properties_->SetServerNetworkStats(server_id.host_port_pair(), |
828 network_stats); | 843 network_stats); |
829 } | 844 } |
830 | 845 |
831 } // namespace net | 846 } // namespace net |
OLD | NEW |