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

Unified Diff: net/spdy/spdy_session.cc

Issue 2862027: Fix crash in GetSpdySessionFromSSLSocket in the case where the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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
===================================================================
--- net/spdy/spdy_session.cc (revision 50644)
+++ net/spdy/spdy_session.cc (working copy)
@@ -300,7 +300,8 @@
net_log_.EndEvent(NetLog::TYPE_SPDY_SESSION, NULL);
}
-void SpdySession::InitializeWithSSLSocket(ClientSocketHandle* connection) {
+net::Error SpdySession::InitializeWithSSLSocket(
+ ClientSocketHandle* connection) {
static StatsCounter spdy_sessions("spdy.sessions");
spdy_sessions.Increment();
@@ -313,7 +314,10 @@
// This is a newly initialized session that no client should have a handle to
// yet, so there's no need to start writing data as in OnTCPConnect(), but we
// should start reading data.
- ReadSocket();
+ net::Error error = ReadSocket();
+ if (error == ERR_IO_PENDING)
+ return OK;
+ return error;
}
net::Error SpdySession::Connect(const std::string& group_name,
@@ -347,6 +351,7 @@
const HttpRequestInfo& request,
const UploadDataStream* upload_data,
const BoundNetLog& stream_net_log) {
+ CHECK_NE(state_, CLOSED);
const GURL& url = request.url;
const std::string& path = url.PathForRequest();
@@ -666,13 +671,13 @@
}
}
-void SpdySession::ReadSocket() {
+net::Error SpdySession::ReadSocket() {
if (read_pending_)
- return;
+ return OK;
if (state_ == CLOSED) {
NOTREACHED();
- return;
+ return ERR_UNEXPECTED;
}
CHECK(connection_.get());
@@ -684,11 +689,11 @@
case 0:
// Socket is closed!
CloseSessionOnError(ERR_CONNECTION_CLOSED);
- return;
+ return ERR_CONNECTION_CLOSED;
case net::ERR_IO_PENDING:
// Waiting for data. Nothing to do now.
read_pending_ = true;
- return;
+ return ERR_IO_PENDING;
default:
// Data was read, process it.
// Schedule the work through the message loop to avoid recursive
@@ -698,6 +703,7 @@
this, &SpdySession::OnReadComplete, bytes_read));
break;
}
+ return OK;
}
void SpdySession::WriteSocketLater() {
« 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