Index: net/quic/quic_stream_factory.h |
diff --git a/net/quic/quic_stream_factory.h b/net/quic/quic_stream_factory.h |
index f13156a94a0d16bf81930ec18e7ae429aaaca2af..9ea641ad8ccb972ac55f3efc61b04a8e4ef44a86 100644 |
--- a/net/quic/quic_stream_factory.h |
+++ b/net/quic/quic_stream_factory.h |
@@ -178,6 +178,11 @@ class NET_EXPORT_PRIVATE QuicStreamFactory |
quic_server_info_factory_ = quic_server_info_factory; |
} |
+ bool enable_connection_racing() const { return enable_connection_racing_; } |
+ void set_enable_connection_racing(bool enable_connection_racing) { |
+ enable_connection_racing_ = enable_connection_racing; |
+ } |
+ |
private: |
class Job; |
friend class test::QuicStreamFactoryPeer; |
@@ -204,10 +209,20 @@ class NET_EXPORT_PRIVATE QuicStreamFactory |
typedef std::set<QuicClientSession*> SessionSet; |
typedef std::map<IpAliasKey, SessionSet> IPAliasMap; |
typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap; |
- typedef std::map<QuicServerId, Job*> JobMap; |
- typedef std::map<QuicStreamRequest*, Job*> RequestMap; |
+ typedef std::set<Job*> JobSet; |
+ typedef std::map<QuicServerId, JobSet> JobMap; |
+ typedef std::map<QuicStreamRequest*, QuicServerId> RequestMap; |
typedef std::set<QuicStreamRequest*> RequestSet; |
- typedef std::map<Job*, RequestSet> JobRequestsMap; |
+ typedef std::map<QuicServerId, RequestSet> ServerIDRequestsMap; |
+ |
+ // Creates a job which waits for server config to be loaded from the disk |
+ // cache. This job is created only when enable_connection_racing_ is enabled |
+ // and there is no server config in memory. |
+ int CreateAuxilaryJob(QuicServerInfo* quic_server_info, |
+ const QuicServerId server_id, |
+ base::StringPiece method, |
+ const BoundNetLog& net_log, |
+ QuicStreamRequest* request); |
// Returns a newly created QuicHttpStream owned by the caller, if a |
// matching session already exists. Returns NULL otherwise. |
@@ -219,6 +234,7 @@ class NET_EXPORT_PRIVATE QuicStreamFactory |
void OnJobComplete(Job* job, int rv); |
bool HasActiveSession(const QuicServerId& server_id) const; |
bool HasActiveJob(const QuicServerId& server_id) const; |
+ void CancelOtherJob(Job* job, const QuicServerId& server_id); |
int CreateSession(const QuicServerId& server_id, |
scoped_ptr<QuicServerInfo> quic_server_info, |
const AddressList& address_list, |
@@ -233,6 +249,10 @@ class NET_EXPORT_PRIVATE QuicStreamFactory |
int64 GetServerNetworkStatsSmoothedRttInMicroseconds( |
const QuicServerId& server_id) const; |
+ // Helped methods. |
+ bool WasAlternateProtocolRecentlyBroken(const QuicServerId& server_id) const; |
+ bool CryptoConfigCacheIsEmpty(const QuicServerId& server_id); |
+ |
// Initializes the cached state associated with |server_id| in |
// |crypto_config_| with the information in |server_info|. |
void InitializeCachedStateInCryptoConfig( |
@@ -274,7 +294,7 @@ class NET_EXPORT_PRIVATE QuicStreamFactory |
QuicCryptoClientConfig crypto_config_; |
JobMap active_jobs_; |
- JobRequestsMap job_requests_map_; |
+ ServerIDRequestsMap job_requests_map_; |
RequestMap active_requests_; |
QuicVersionVector supported_versions_; |
@@ -305,6 +325,11 @@ class NET_EXPORT_PRIVATE QuicStreamFactory |
// Set this for setting config's BytesForConnectionIdToSend (TCID param) to 0. |
bool enable_truncated_connection_ids_; |
+ // Set if we want to race connections - one connection that sends |
+ // INCHOATE_HELLO and another connection that sends CHLO after loading server |
+ // config from the disk cache. |
+ bool enable_connection_racing_; |
+ |
// Each profile will (probably) have a unique port_seed_ value. This value is |
// used to help seed a pseudo-random number generator (PortSuggester) so that |
// we consistently (within this profile) suggest the same ephemeral port when |