diff options
Diffstat (limited to 'net/spdy/spdy_proxy_client_socket.cc')
-rw-r--r-- | net/spdy/spdy_proxy_client_socket.cc | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/net/spdy/spdy_proxy_client_socket.cc b/net/spdy/spdy_proxy_client_socket.cc index 484be0c..7dbf83e 100644 --- a/net/spdy/spdy_proxy_client_socket.cc +++ b/net/spdy/spdy_proxy_client_socket.cc @@ -44,7 +44,6 @@ SpdyProxyClientSocket::SpdyProxyClientSocket( user_buffer_(NULL), write_buffer_len_(0), write_bytes_outstanding_(0), - eof_has_been_read_(false), ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), net_log_(spdy_stream->net_log()) { request_.method = "CONNECT"; @@ -124,12 +123,11 @@ void SpdyProxyClientSocket::Disconnect() { } bool SpdyProxyClientSocket::IsConnected() const { - return next_state_ == STATE_OPEN || next_state_ == STATE_CLOSED; + return next_state_ == STATE_OPEN; } bool SpdyProxyClientSocket::IsConnectedAndIdle() const { - return IsConnected() && spdy_stream_.get() != NULL && - !spdy_stream_->is_idle(); + return IsConnected() && read_buffer_.empty() && spdy_stream_->is_idle(); } const BoundNetLog& SpdyProxyClientSocket::NetLog() const { @@ -168,10 +166,7 @@ int SpdyProxyClientSocket::Read(IOBuffer* buf, int buf_len, if (next_state_ == STATE_DISCONNECTED) return ERR_SOCKET_NOT_CONNECTED; - if (!spdy_stream_ && read_buffer_.empty()) { - if (eof_has_been_read_) - return ERR_CONNECTION_CLOSED; - eof_has_been_read_ = true; + if (next_state_ == STATE_CLOSED && read_buffer_.empty()) { return 0; } @@ -212,12 +207,10 @@ int SpdyProxyClientSocket::PopulateUserReadBuffer() { int SpdyProxyClientSocket::Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback) { DCHECK(!write_callback_); - if (next_state_ == STATE_DISCONNECTED) + if (next_state_ != STATE_OPEN) return ERR_SOCKET_NOT_CONNECTED; - if (!spdy_stream_) - return ERR_CONNECTION_CLOSED; - + DCHECK(spdy_stream_); write_bytes_outstanding_= buf_len; if (buf_len <= kMaxSpdyFrameChunkSize) { int rv = spdy_stream_->WriteStreamData(buf, buf_len, spdy::DATA_FLAG_NONE); |