From b862327fcecf4e282bcaf033354ba9073d9777e4 Mon Sep 17 00:00:00 2001 From: "ukai@chromium.org" Date: Wed, 4 Nov 2009 03:57:26 +0000 Subject: Minor fixes in SocketStream. Commented on http://codereview.chromium.org/345025 BUG=none TEST=none Review URL: http://codereview.chromium.org/355022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30937 0039d316-1c4b-4281-b951-d872f2087c98 --- net/socket_stream/socket_stream.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc index 6ef8c33..62aad61 100644 --- a/net/socket_stream/socket_stream.cc +++ b/net/socket_stream/socket_stream.cc @@ -638,7 +638,7 @@ int SocketStream::DoSOCKSConnectComplete(int result) { if (is_secure()) next_state_ = STATE_SSL_CONNECT; else - DidEstablishConnection(); + result = DidEstablishConnection(); } return result; } @@ -688,7 +688,7 @@ int SocketStream::DoReadWrite(int result) { return ERR_CONNECTION_CLOSED; } // If read is pending, try write as well. - // Otherwise, return the result and do next loop. + // Otherwise, return the result and do next loop (to close the connection). if (result != ERR_IO_PENDING) { next_state_ = STATE_CLOSE; return result; @@ -708,6 +708,12 @@ int SocketStream::DoReadWrite(int result) { DidSendData(result); return OK; } + // If write is not pending, return the result and do next loop (to close + // the connection). + if (result != 0 && result != ERR_IO_PENDING) { + next_state_ = STATE_CLOSE; + return result; + } return result; } -- cgit v1.1