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

Unified Diff: net/spdy/spdy_session.cc

Issue 208663003: Revert of Fix SPDY error-handling if the connection gets closed just after use. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_pool.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_session.cc
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 5f0e285afc135ad7577ced68f6d2317b75c5d2e1..c20d89e4a05e40c1cf34bcade93a8ff8840ff02e 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -532,7 +532,7 @@
net_log_.EndEvent(NetLog::TYPE_SPDY_SESSION);
}
-void SpdySession::InitializeWithSocket(
+Error SpdySession::InitializeWithSocket(
scoped_ptr<ClientSocketHandle> connection,
SpdySessionPool* pool,
bool is_secure,
@@ -593,17 +593,19 @@
NetLog::TYPE_SPDY_SESSION_INITIALIZED,
connection_->socket()->NetLog().source().ToEventParametersCallback());
- DCHECK_NE(availability_state_, STATE_CLOSED);
- connection_->AddHigherLayeredPool(this);
- if (enable_sending_initial_data_)
- SendInitialData();
- pool_ = pool;
-
- // Bootstrap the read loop.
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&SpdySession::PumpReadLoop,
- weak_factory_.GetWeakPtr(), READ_STATE_DO_READ, OK));
+ int error = DoReadLoop(READ_STATE_DO_READ, OK);
+ if (error == ERR_IO_PENDING)
+ error = OK;
+ if (error == OK) {
+ DCHECK_NE(availability_state_, STATE_CLOSED);
+ connection_->AddHigherLayeredPool(this);
+ if (enable_sending_initial_data_)
+ SendInitialData();
+ pool_ = pool;
+ } else {
+ DcheckClosed();
+ }
+ return static_cast<Error>(error);
}
bool SpdySession::VerifyDomainAuthentication(const std::string& domain) {
@@ -1552,8 +1554,9 @@
UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySession.BytesRead.OtherErrors",
total_bytes_received_, 1, 100000000, 50);
- DCHECK(pool_);
- if (availability_state_ != STATE_GOING_AWAY)
+ // |pool_| will be NULL when |InitializeWithSocket()| is in the
+ // call stack.
+ if (pool_ && availability_state_ != STATE_GOING_AWAY)
pool_->MakeSessionUnavailable(GetWeakPtr());
availability_state_ = STATE_CLOSED;
@@ -1625,8 +1628,10 @@
void SpdySession::MakeUnavailable() {
if (availability_state_ < STATE_GOING_AWAY) {
availability_state_ = STATE_GOING_AWAY;
- DCHECK(pool_);
- pool_->MakeSessionUnavailable(GetWeakPtr());
+ // |pool_| will be NULL when |InitializeWithSocket()| is in the
+ // call stack.
+ if (pool_)
+ pool_->MakeSessionUnavailable(GetWeakPtr());
}
}
@@ -1681,8 +1686,7 @@
}
bool SpdySession::IsReused() const {
- return buffered_spdy_framer_->frames_received() > 0 ||
- connection_->reuse_type() == ClientSocketHandle::UNUSED_IDLE;
+ return buffered_spdy_framer_->frames_received() > 0;
}
bool SpdySession::GetLoadTimingInfo(SpdyStreamId stream_id,
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698