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

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

Issue 339663010: Add a probability to Alternate-Protocol support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: eliminate static initializer Created 6 years, 5 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 | Annotate | Revision Log
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 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 // alternate-protocol state is unknown. 932 // alternate-protocol state is unknown.
933 if (!http_server_properties_->HasAlternateProtocol(server)) 933 if (!http_server_properties_->HasAlternateProtocol(server))
934 return; 934 return;
935 935
936 // TODO(rch): In the special case where the session has received no 936 // TODO(rch): In the special case where the session has received no
937 // packets from the peer, we should consider blacklisting this 937 // packets from the peer, we should consider blacklisting this
938 // differently so that we still race TCP but we don't consider the 938 // differently so that we still race TCP but we don't consider the
939 // session connected until the handshake has been confirmed. 939 // session connected until the handshake has been confirmed.
940 HistogramBrokenAlternateProtocolLocation( 940 HistogramBrokenAlternateProtocolLocation(
941 BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_STREAM_FACTORY); 941 BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_STREAM_FACTORY);
942 PortAlternateProtocolPair alternate = 942 AlternateProtocolInfo alternate =
943 http_server_properties_->GetAlternateProtocol(server); 943 http_server_properties_->GetAlternateProtocol(server);
944 DCHECK_EQ(QUIC, alternate.protocol); 944 DCHECK_EQ(QUIC, alternate.protocol);
945 945
946 // Since the session was active, there's no longer an 946 // Since the session was active, there's no longer an
947 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the 947 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the
948 // TCP job also fails. So to avoid not using QUIC when we otherwise could, 948 // TCP job also fails. So to avoid not using QUIC when we otherwise could,
949 // we mark it as broken, and then immediately re-enable it. This leaves 949 // we mark it as broken, and then immediately re-enable it. This leaves
950 // QUIC as "recently broken" which means that 0-RTT will be disabled but 950 // QUIC as "recently broken" which means that 0-RTT will be disabled but
951 // we'll still race. 951 // we'll still race.
952 http_server_properties_->SetBrokenAlternateProtocol(server); 952 http_server_properties_->SetBrokenAlternateProtocol(server);
953 http_server_properties_->ClearAlternateProtocol(server); 953 http_server_properties_->ClearAlternateProtocol(server);
954 http_server_properties_->SetAlternateProtocol( 954 http_server_properties_->SetAlternateProtocol(
955 server, alternate.port, alternate.protocol); 955 server, alternate.port, alternate.protocol, 1);
956 DCHECK_EQ(QUIC, 956 DCHECK_EQ(QUIC,
957 http_server_properties_->GetAlternateProtocol(server).protocol); 957 http_server_properties_->GetAlternateProtocol(server).protocol);
958 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( 958 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken(
959 server)); 959 server));
960 } 960 }
961 961
962 } // namespace net 962 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_network_transaction_unittest.cc ('k') | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698