summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-09 18:48:25 +0000
committerrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-09 18:48:25 +0000
commit557c435ca6354cd607e64633f36ddb66a15976ad (patch)
treec2b4abe4d54937c6e13fb8520ba298dc5a88ab88 /net
parent15a8797688974ea2b528f105a3f3e6af2b31d884 (diff)
downloadchromium_src-557c435ca6354cd607e64633f36ddb66a15976ad.zip
chromium_src-557c435ca6354cd607e64633f36ddb66a15976ad.tar.gz
chromium_src-557c435ca6354cd607e64633f36ddb66a15976ad.tar.bz2
Revert 181626
> Revert 181569 > > SPDY - Added back code that deleted read_pending_. > > > > R=rch@chromium.org > > BUG=175069 > > > > Review URL: https://chromiumcodereview.appspot.com/12224078 > > TBR=rtenneti@chromium.org > Review URL: https://codereview.chromium.org/12208103 TBR=rtenneti@chromium.org Review URL: https://codereview.chromium.org/12212101 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181627 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/spdy/spdy_session.cc14
-rw-r--r--net/spdy/spdy_session.h1
2 files changed, 14 insertions, 1 deletions
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index f214afc..c6c25cd 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -233,6 +233,7 @@ SpdySession::SpdySession(const HostPortProxyPair& host_port_proxy_pair,
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 @@ LoadState SpdySession::GetLoadState() const {
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::DoLoop(int result) {
}
int SpdySession::DoRead() {
+ DCHECK(!read_pending_);
if (bytes_read_ > kMaxReadBytes) {
state_ = STATE_DO_READ;
MessageLoop::current()->PostTask(
@@ -825,10 +832,13 @@ int SpdySession::DoRead() {
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 @@ int SpdySession::DoReadComplete(int result) {
// 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);
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h
index c0b5d15..e2c73ed 100644
--- a/net/spdy/spdy_session.h
+++ b/net/spdy/spdy_session.h
@@ -625,6 +625,7 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>,
// The read buffer used to read data from the socket.
scoped_refptr<IOBuffer> read_buffer_;
+ bool read_pending_;
int stream_hi_water_mark_; // The next stream id to use.