Chromium Code Reviews| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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"; | 66 const char kDummyHostname[] = "quic.global.props"; |
| 67 const uint16 kDummyPort = 0; | 67 const uint16 kDummyPort = 0; |
|
ramant (doing other things)
2015/02/03 18:09:37
nit: lines 65-67 could be deleted.
Ryan Hamilton
2015/02/03 22:50:45
Done.
| |
| 68 | 68 |
| 69 void HistogramCreateSessionFailure(enum CreateSessionFailure error) { | 69 void HistogramCreateSessionFailure(enum CreateSessionFailure error) { |
| 70 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.CreationError", error, | 70 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.CreationError", error, |
| 71 CREATION_ERROR_MAX); | 71 CREATION_ERROR_MAX); |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool IsEcdsaSupported() { | 74 bool IsEcdsaSupported() { |
| 75 #if defined(OS_WIN) | 75 #if defined(OS_WIN) |
| 76 if (base::win::GetVersion() < base::win::VERSION_VISTA) | 76 if (base::win::GetVersion() < base::win::VERSION_VISTA) |
| 77 return false; | 77 return false; |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 613 delete all_sessions_.begin()->first; | 613 delete all_sessions_.begin()->first; |
| 614 all_sessions_.erase(all_sessions_.begin()); | 614 all_sessions_.erase(all_sessions_.begin()); |
| 615 } | 615 } |
| 616 STLDeleteValues(&active_jobs_); | 616 STLDeleteValues(&active_jobs_); |
| 617 } | 617 } |
| 618 | 618 |
| 619 void QuicStreamFactory::set_require_confirmation(bool require_confirmation) { | 619 void QuicStreamFactory::set_require_confirmation(bool require_confirmation) { |
| 620 require_confirmation_ = require_confirmation; | 620 require_confirmation_ = require_confirmation; |
| 621 if (http_server_properties_ && (!(local_address_ == IPEndPoint()))) { | 621 if (http_server_properties_ && (!(local_address_ == IPEndPoint()))) { |
| 622 // TODO(rtenneti): Delete host_port_pair and persist data in globals. | 622 // TODO(rtenneti): Delete host_port_pair and persist data in globals. |
| 623 HostPortPair host_port_pair(kDummyHostname, kDummyPort); | 623 HostPortPair host_port_pair(kDummyHostname, kDummyPort); |
|
ramant (doing other things)
2015/02/03 18:09:37
nit: line 623 could be deleted.
Ryan Hamilton
2015/02/03 22:50:45
*facepalm* Done.
| |
| 624 http_server_properties_->SetSupportsQuic( | 624 http_server_properties_->SetSupportsQuic(!require_confirmation, |
| 625 host_port_pair, !require_confirmation, | 625 local_address_.address()); |
| 626 local_address_.ToStringWithoutPort()); | |
| 627 } | 626 } |
| 628 } | 627 } |
| 629 | 628 |
| 630 int QuicStreamFactory::Create(const HostPortPair& host_port_pair, | 629 int QuicStreamFactory::Create(const HostPortPair& host_port_pair, |
| 631 bool is_https, | 630 bool is_https, |
| 632 PrivacyMode privacy_mode, | 631 PrivacyMode privacy_mode, |
| 633 base::StringPiece method, | 632 base::StringPiece method, |
| 634 const BoundNetLog& net_log, | 633 const BoundNetLog& net_log, |
| 635 QuicStreamRequest* request) { | 634 QuicStreamRequest* request) { |
| 636 QuicServerId server_id(host_port_pair, is_https, privacy_mode); | 635 QuicServerId server_id(host_port_pair, is_https, privacy_mode); |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 995 // wrong encryption level, when the send buffer is full. | 994 // wrong encryption level, when the send buffer is full. |
| 996 rv = socket->SetSendBufferSize(kMaxPacketSize * 20); | 995 rv = socket->SetSendBufferSize(kMaxPacketSize * 20); |
| 997 if (rv != OK) { | 996 if (rv != OK) { |
| 998 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); | 997 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); |
| 999 return rv; | 998 return rv; |
| 1000 } | 999 } |
| 1001 | 1000 |
| 1002 socket->GetLocalAddress(&local_address_); | 1001 socket->GetLocalAddress(&local_address_); |
| 1003 if (check_persisted_supports_quic_ && http_server_properties_) { | 1002 if (check_persisted_supports_quic_ && http_server_properties_) { |
| 1004 check_persisted_supports_quic_ = false; | 1003 check_persisted_supports_quic_ = false; |
| 1005 // TODO(rtenneti): Delete host_port_pair and persist data in globals. | 1004 IPAddressNumber last_address; |
| 1006 HostPortPair host_port_pair(kDummyHostname, kDummyPort); | 1005 if (http_server_properties_->GetSupportsQuic(&last_address) && |
| 1007 SupportsQuic supports_quic(true, local_address_.ToStringWithoutPort()); | 1006 last_address == local_address_.address()) { |
| 1008 if (http_server_properties_->GetSupportsQuic( | |
| 1009 host_port_pair).Equals(supports_quic)) { | |
| 1010 require_confirmation_ = false; | 1007 require_confirmation_ = false; |
| 1011 } | 1008 } |
| 1012 } | 1009 } |
| 1013 | 1010 |
| 1014 DefaultPacketWriterFactory packet_writer_factory(socket.get()); | 1011 DefaultPacketWriterFactory packet_writer_factory(socket.get()); |
| 1015 | 1012 |
| 1016 if (!helper_.get()) { | 1013 if (!helper_.get()) { |
| 1017 helper_.reset(new QuicConnectionHelper( | 1014 helper_.reset(new QuicConnectionHelper( |
| 1018 base::MessageLoop::current()->message_loop_proxy().get(), | 1015 base::MessageLoop::current()->message_loop_proxy().get(), |
| 1019 clock_.get(), random_generator_)); | 1016 clock_.get(), random_generator_)); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1272 http_server_properties_->ClearAlternateProtocol(server); | 1269 http_server_properties_->ClearAlternateProtocol(server); |
| 1273 http_server_properties_->SetAlternateProtocol( | 1270 http_server_properties_->SetAlternateProtocol( |
| 1274 server, alternate.port, alternate.protocol, 1); | 1271 server, alternate.port, alternate.protocol, 1); |
| 1275 DCHECK_EQ(QUIC, | 1272 DCHECK_EQ(QUIC, |
| 1276 http_server_properties_->GetAlternateProtocol(server).protocol); | 1273 http_server_properties_->GetAlternateProtocol(server).protocol); |
| 1277 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( | 1274 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( |
| 1278 server)); | 1275 server)); |
| 1279 } | 1276 } |
| 1280 | 1277 |
| 1281 } // namespace net | 1278 } // namespace net |
| OLD | NEW |