Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: net/quic/quic_stream_factory.cc

Issue 892203004: Make HttpServerProperties::GetSupportsQuic not host-specific. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_server_properties_manager_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 // When a connection is idle for 30 seconds it will be closed. 57 // When a connection is idle for 30 seconds it will be closed.
58 const int kIdleConnectionTimeoutSeconds = 30; 58 const int kIdleConnectionTimeoutSeconds = 30;
59 59
60 // The initial receive window size for both streams and sessions. 60 // The initial receive window size for both streams and sessions.
61 const int32 kInitialReceiveWindowSize = 10 * 1024 * 1024; // 10MB 61 const int32 kInitialReceiveWindowSize = 10 * 1024 * 1024; // 10MB
62 62
63 // Set the maximum number of undecryptable packets the connection will store. 63 // Set the maximum number of undecryptable packets the connection will store.
64 const int32 kMaxUndecryptablePackets = 100; 64 const int32 kMaxUndecryptablePackets = 100;
65 65
66 const char kDummyHostname[] = "quic.global.props";
67 const uint16 kDummyPort = 0;
68
69 void HistogramCreateSessionFailure(enum CreateSessionFailure error) { 66 void HistogramCreateSessionFailure(enum CreateSessionFailure error) {
70 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.CreationError", error, 67 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.CreationError", error,
71 CREATION_ERROR_MAX); 68 CREATION_ERROR_MAX);
72 } 69 }
73 70
74 bool IsEcdsaSupported() { 71 bool IsEcdsaSupported() {
75 #if defined(OS_WIN) 72 #if defined(OS_WIN)
76 if (base::win::GetVersion() < base::win::VERSION_VISTA) 73 if (base::win::GetVersion() < base::win::VERSION_VISTA)
77 return false; 74 return false;
78 #endif 75 #endif
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 while (!all_sessions_.empty()) { 609 while (!all_sessions_.empty()) {
613 delete all_sessions_.begin()->first; 610 delete all_sessions_.begin()->first;
614 all_sessions_.erase(all_sessions_.begin()); 611 all_sessions_.erase(all_sessions_.begin());
615 } 612 }
616 STLDeleteValues(&active_jobs_); 613 STLDeleteValues(&active_jobs_);
617 } 614 }
618 615
619 void QuicStreamFactory::set_require_confirmation(bool require_confirmation) { 616 void QuicStreamFactory::set_require_confirmation(bool require_confirmation) {
620 require_confirmation_ = require_confirmation; 617 require_confirmation_ = require_confirmation;
621 if (http_server_properties_ && (!(local_address_ == IPEndPoint()))) { 618 if (http_server_properties_ && (!(local_address_ == IPEndPoint()))) {
622 // TODO(rtenneti): Delete host_port_pair and persist data in globals. 619 http_server_properties_->SetSupportsQuic(!require_confirmation,
623 HostPortPair host_port_pair(kDummyHostname, kDummyPort); 620 local_address_.address());
624 http_server_properties_->SetSupportsQuic(
625 host_port_pair, !require_confirmation,
626 local_address_.ToStringWithoutPort());
627 } 621 }
628 } 622 }
629 623
630 int QuicStreamFactory::Create(const HostPortPair& host_port_pair, 624 int QuicStreamFactory::Create(const HostPortPair& host_port_pair,
631 bool is_https, 625 bool is_https,
632 PrivacyMode privacy_mode, 626 PrivacyMode privacy_mode,
633 base::StringPiece method, 627 base::StringPiece method,
634 const BoundNetLog& net_log, 628 const BoundNetLog& net_log,
635 QuicStreamRequest* request) { 629 QuicStreamRequest* request) {
636 QuicServerId server_id(host_port_pair, is_https, privacy_mode); 630 QuicServerId server_id(host_port_pair, is_https, privacy_mode);
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 // wrong encryption level, when the send buffer is full. 989 // wrong encryption level, when the send buffer is full.
996 rv = socket->SetSendBufferSize(kMaxPacketSize * 20); 990 rv = socket->SetSendBufferSize(kMaxPacketSize * 20);
997 if (rv != OK) { 991 if (rv != OK) {
998 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); 992 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER);
999 return rv; 993 return rv;
1000 } 994 }
1001 995
1002 socket->GetLocalAddress(&local_address_); 996 socket->GetLocalAddress(&local_address_);
1003 if (check_persisted_supports_quic_ && http_server_properties_) { 997 if (check_persisted_supports_quic_ && http_server_properties_) {
1004 check_persisted_supports_quic_ = false; 998 check_persisted_supports_quic_ = false;
1005 // TODO(rtenneti): Delete host_port_pair and persist data in globals. 999 IPAddressNumber last_address;
1006 HostPortPair host_port_pair(kDummyHostname, kDummyPort); 1000 if (http_server_properties_->GetSupportsQuic(&last_address) &&
1007 SupportsQuic supports_quic(true, local_address_.ToStringWithoutPort()); 1001 last_address == local_address_.address()) {
1008 if (http_server_properties_->GetSupportsQuic(
1009 host_port_pair).Equals(supports_quic)) {
1010 require_confirmation_ = false; 1002 require_confirmation_ = false;
1011 } 1003 }
1012 } 1004 }
1013 1005
1014 DefaultPacketWriterFactory packet_writer_factory(socket.get()); 1006 DefaultPacketWriterFactory packet_writer_factory(socket.get());
1015 1007
1016 if (!helper_.get()) { 1008 if (!helper_.get()) {
1017 helper_.reset(new QuicConnectionHelper( 1009 helper_.reset(new QuicConnectionHelper(
1018 base::MessageLoop::current()->message_loop_proxy().get(), 1010 base::MessageLoop::current()->message_loop_proxy().get(),
1019 clock_.get(), random_generator_)); 1011 clock_.get(), random_generator_));
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 http_server_properties_->ClearAlternateProtocol(server); 1264 http_server_properties_->ClearAlternateProtocol(server);
1273 http_server_properties_->SetAlternateProtocol( 1265 http_server_properties_->SetAlternateProtocol(
1274 server, alternate.port, alternate.protocol, 1); 1266 server, alternate.port, alternate.protocol, 1);
1275 DCHECK_EQ(QUIC, 1267 DCHECK_EQ(QUIC,
1276 http_server_properties_->GetAlternateProtocol(server).protocol); 1268 http_server_properties_->GetAlternateProtocol(server).protocol);
1277 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( 1269 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken(
1278 server)); 1270 server));
1279 } 1271 }
1280 1272
1281 } // namespace net 1273 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_server_properties_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698