Avoid setting a duplicate SpdySessionKey on a Request

BUG=364365

Review URL: https://codereview.chromium.org/344603004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278366 0039d316-1c4b-4281-b951-d872f2087c98
parent 5885b696
...@@ -790,7 +790,8 @@ int HttpStreamFactoryImpl::Job::DoInitConnection() { ...@@ -790,7 +790,8 @@ int HttpStreamFactoryImpl::Job::DoInitConnection() {
next_state_ = STATE_CREATE_STREAM; next_state_ = STATE_CREATE_STREAM;
existing_spdy_session_ = spdy_session; existing_spdy_session_ = spdy_session;
return OK; return OK;
} else if (request_ && (using_ssl_ || ShouldForceSpdyWithoutSSL())) { } else if (request_ && !request_->HasSpdySessionKey() &&
(using_ssl_ || ShouldForceSpdyWithoutSSL())) {
// Update the spdy session key for the request that launched this job. // Update the spdy session key for the request that launched this job.
request_->SetSpdySessionKey(spdy_session_key); request_->SetSpdySessionKey(spdy_session_key);
} }
......
...@@ -54,7 +54,7 @@ HttpStreamFactoryImpl::Request::~Request() { ...@@ -54,7 +54,7 @@ HttpStreamFactoryImpl::Request::~Request() {
void HttpStreamFactoryImpl::Request::SetSpdySessionKey( void HttpStreamFactoryImpl::Request::SetSpdySessionKey(
const SpdySessionKey& spdy_session_key) { const SpdySessionKey& spdy_session_key) {
DCHECK(!spdy_session_key_.get()); CHECK(!spdy_session_key_.get());
spdy_session_key_.reset(new SpdySessionKey(spdy_session_key)); spdy_session_key_.reset(new SpdySessionKey(spdy_session_key));
RequestSet& request_set = RequestSet& request_set =
factory_->spdy_session_request_map_[spdy_session_key]; factory_->spdy_session_request_map_[spdy_session_key];
...@@ -250,6 +250,10 @@ HttpStreamFactoryImpl::Request::RemoveRequestFromSpdySessionRequestMap() { ...@@ -250,6 +250,10 @@ HttpStreamFactoryImpl::Request::RemoveRequestFromSpdySessionRequestMap() {
} }
} }
bool HttpStreamFactoryImpl::Request::HasSpdySessionKey() const {
return spdy_session_key_.get() != NULL;
}
// TODO(jgraettinger): Currently, HttpStreamFactoryImpl::Job notifies a // TODO(jgraettinger): Currently, HttpStreamFactoryImpl::Job notifies a
// Request that the session is ready, which in turn notifies it's delegate, // Request that the session is ready, which in turn notifies it's delegate,
// and then it notifies HttpStreamFactoryImpl so that /other/ requests may // and then it notifies HttpStreamFactoryImpl so that /other/ requests may
......
...@@ -37,6 +37,7 @@ class HttpStreamFactoryImpl::Request : public HttpStreamRequest { ...@@ -37,6 +37,7 @@ class HttpStreamFactoryImpl::Request : public HttpStreamRequest {
// for this SpdySessionKey, since we may need to wait for NPN to complete // for this SpdySessionKey, since we may need to wait for NPN to complete
// before knowing if SPDY is available. // before knowing if SPDY is available.
void SetSpdySessionKey(const SpdySessionKey& spdy_session_key); void SetSpdySessionKey(const SpdySessionKey& spdy_session_key);
bool HasSpdySessionKey() const;
// Attaches |job| to this request. Does not mean that Request will use |job|, // Attaches |job| to this request. Does not mean that Request will use |job|,
// but Request will own |job|. // but Request will own |job|.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment