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

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

Issue 2487973003: GOAWAY open QUIC sessions if clock skew is detected (Closed)
Patch Set: format Created 4 years, 1 month 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
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/chromium/quic_stream_factory.h" 5 #include "net/quic/chromium/quic_stream_factory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <tuple> 8 #include <tuple>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 host_resolver_(host_resolver), 746 host_resolver_(host_resolver),
747 client_socket_factory_(client_socket_factory), 747 client_socket_factory_(client_socket_factory),
748 http_server_properties_(http_server_properties), 748 http_server_properties_(http_server_properties),
749 proxy_delegate_(proxy_delegate), 749 proxy_delegate_(proxy_delegate),
750 transport_security_state_(transport_security_state), 750 transport_security_state_(transport_security_state),
751 cert_transparency_verifier_(cert_transparency_verifier), 751 cert_transparency_verifier_(cert_transparency_verifier),
752 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), 752 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory),
753 random_generator_(random_generator), 753 random_generator_(random_generator),
754 clock_(clock), 754 clock_(clock),
755 max_packet_length_(max_packet_length), 755 max_packet_length_(max_packet_length),
756 clock_skew_detector_(base::TimeTicks::Now(), base::Time::Now()),
756 socket_performance_watcher_factory_(socket_performance_watcher_factory), 757 socket_performance_watcher_factory_(socket_performance_watcher_factory),
757 config_(InitializeQuicConfig(connection_options, 758 config_(InitializeQuicConfig(connection_options,
758 idle_connection_timeout_seconds)), 759 idle_connection_timeout_seconds)),
759 crypto_config_(base::WrapUnique( 760 crypto_config_(base::WrapUnique(
760 new ProofVerifierChromium(cert_verifier, 761 new ProofVerifierChromium(cert_verifier,
761 ct_policy_enforcer, 762 ct_policy_enforcer,
762 transport_security_state, 763 transport_security_state,
763 cert_transparency_verifier))), 764 cert_transparency_verifier))),
764 supported_versions_(supported_versions), 765 supported_versions_(supported_versions),
765 enable_port_selection_(enable_port_selection), 766 enable_port_selection_(enable_port_selection),
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 return false; 919 return false;
919 } 920 }
920 921
921 int QuicStreamFactory::Create(const QuicServerId& server_id, 922 int QuicStreamFactory::Create(const QuicServerId& server_id,
922 const HostPortPair& destination, 923 const HostPortPair& destination,
923 int cert_verify_flags, 924 int cert_verify_flags,
924 const GURL& url, 925 const GURL& url,
925 base::StringPiece method, 926 base::StringPiece method,
926 const NetLogWithSource& net_log, 927 const NetLogWithSource& net_log,
927 QuicStreamRequest* request) { 928 QuicStreamRequest* request) {
929 if (clock_skew_detector_.ClockSkewDetected(base::TimeTicks::Now(),
930 base::Time::Now())) {
931 while (!active_sessions_.empty()) {
932 QuicChromiumClientSession* session = active_sessions_.begin()->second;
933 OnSessionGoingAway(session);
934 // TODO(rch): actually close the session?
935 }
936 }
928 DCHECK(server_id.host_port_pair().Equals(HostPortPair::FromURL(url))); 937 DCHECK(server_id.host_port_pair().Equals(HostPortPair::FromURL(url)));
929 // Enforce session affinity for promised streams. 938 // Enforce session affinity for promised streams.
930 QuicClientPromisedInfo* promised = 939 QuicClientPromisedInfo* promised =
931 push_promise_index_.GetPromised(url.spec()); 940 push_promise_index_.GetPromised(url.spec());
932 if (promised) { 941 if (promised) {
933 QuicChromiumClientSession* session = 942 QuicChromiumClientSession* session =
934 static_cast<QuicChromiumClientSession*>(promised->session()); 943 static_cast<QuicChromiumClientSession*>(promised->session());
935 DCHECK(session); 944 DCHECK(session);
936 if (session->server_id().privacy_mode() == server_id.privacy_mode()) { 945 if (session->server_id().privacy_mode() == server_id.privacy_mode()) {
937 request->SetSession(session); 946 request->SetSession(session);
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 void QuicStreamFactory::OpenFactory() { 1919 void QuicStreamFactory::OpenFactory() {
1911 status_ = OPEN; 1920 status_ = OPEN;
1912 } 1921 }
1913 1922
1914 void QuicStreamFactory::MaybeClearConsecutiveDisabledCount() { 1923 void QuicStreamFactory::MaybeClearConsecutiveDisabledCount() {
1915 if (status_ == OPEN) 1924 if (status_ == OPEN)
1916 consecutive_disabled_count_ = 0; 1925 consecutive_disabled_count_ = 0;
1917 } 1926 }
1918 1927
1919 } // namespace net 1928 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698