Chromium Code Reviews| Index: net/spdy/spdy_proxy_client_socket.cc |
| =================================================================== |
| --- net/spdy/spdy_proxy_client_socket.cc (revision 112347) |
| +++ net/spdy/spdy_proxy_client_socket.cc (working copy) |
| @@ -44,7 +44,6 @@ |
| 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 @@ |
| } |
| 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,8 @@ |
| 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()) { |
| + Disconnect(); |
|
wtc
2011/12/02 23:16:40
This Disconnect() call may not be necessary.
I un
Ryan Hamilton
2011/12/02 23:59:17
You're right. recv will return 0 each time you ca
|
| return 0; |
| } |
| @@ -212,12 +208,10 @@ |
| 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); |