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

Unified Diff: net/spdy/spdy_session.cc

Issue 12224078: SPDY - Added back code that deleted read_pending_. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 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') | no next file » | 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 181407)
+++ net/spdy/spdy_session.cc (working copy)
@@ -233,6 +233,7 @@
http_server_properties_(http_server_properties),
connection_(new ClientSocketHandle),
read_buffer_(new IOBuffer(kReadBufferSize)),
+ read_pending_(false),
stream_hi_water_mark_(kFirstStreamId),
write_pending_(false),
delayed_write_pending_(false),
@@ -781,17 +782,22 @@
void SpdySession::OnReadComplete(int bytes_read) {
DCHECK_NE(state_, STATE_DO_READ);
+ read_pending_ = false;
DoLoop(bytes_read);
}
void SpdySession::StartRead() {
DCHECK_NE(state_, STATE_DO_READ_COMPLETE);
+ read_pending_ = false;
DoLoop(OK);
}
int SpdySession::DoLoop(int result) {
bytes_read_ = 0;
do {
+ if (read_pending_)
+ return OK;
+
switch (state_) {
case STATE_DO_READ:
DCHECK_EQ(result, OK);
@@ -813,6 +819,7 @@
}
int SpdySession::DoRead() {
+ DCHECK(!read_pending_);
if (bytes_read_ > kMaxReadBytes) {
state_ = STATE_DO_READ;
MessageLoop::current()->PostTask(
@@ -825,10 +832,13 @@
CHECK(connection_.get());
CHECK(connection_->socket());
state_ = STATE_DO_READ_COMPLETE;
- return connection_->socket()->Read(
+ int result = connection_->socket()->Read(
read_buffer_.get(),
kReadBufferSize,
base::Bind(&SpdySession::OnReadComplete, base::Unretained(this)));
+ if (result == net::ERR_IO_PENDING)
+ read_pending_ = true;
+ return result;
}
int SpdySession::DoReadComplete(int result) {
@@ -836,6 +846,8 @@
// buffer (32KB).
// TODO(mbelshe): support arbitrarily large frames!
+ DCHECK(!read_pending_);
+
if (result <= 0) {
// Session is tearing down.
net::Error error = static_cast<net::Error>(result);
« no previous file with comments | « net/spdy/spdy_session.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698