diff options
Diffstat (limited to 'net/socket_stream')
-rw-r--r-- | net/socket_stream/socket_stream.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc index 1d10ad5..b6d3a65 100644 --- a/net/socket_stream/socket_stream.cc +++ b/net/socket_stream/socket_stream.cc @@ -167,8 +167,9 @@ void SocketStream::Close() { "The current MessageLoop must exist"; DCHECK_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()) << "The current MessageLoop must be TYPE_IO"; - if (socket_.get() && socket_->IsConnected()) - socket_->Disconnect(); + if (!socket_.get() || !socket_->IsConnected() || next_state_ == STATE_NONE) + return; + socket_->Disconnect(); next_state_ = STATE_CLOSE; // Close asynchronously, so that delegate won't be called // back before returning Close(). |