diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-02 16:15:04 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-02 16:15:04 +0000 |
commit | 8e12ae06a009107635e2045db802907fd4ae2df1 (patch) | |
tree | 57b436733c451ea738a9c3795e204fb559613626 /net/socket | |
parent | 78a3a6f8ea98f45a4b8f41f1dfc067f913815f43 (diff) | |
download | chromium_src-8e12ae06a009107635e2045db802907fd4ae2df1.zip chromium_src-8e12ae06a009107635e2045db802907fd4ae2df1.tar.gz chromium_src-8e12ae06a009107635e2045db802907fd4ae2df1.tar.bz2 |
Make ConnectJob::ReleaseSocket() return NULL on connection error.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/150205
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19819 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket')
-rw-r--r-- | net/socket/client_socket_pool_base.cc | 1 | ||||
-rw-r--r-- | net/socket/client_socket_pool_base.h | 3 | ||||
-rw-r--r-- | net/socket/tcp_client_socket_pool.cc | 3 |
3 files changed, 6 insertions, 1 deletions
diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc index 2a32e4d..0afe53e 100644 --- a/net/socket/client_socket_pool_base.cc +++ b/net/socket/client_socket_pool_base.cc @@ -307,6 +307,7 @@ void ClientSocketPoolBase::OnConnectJobComplete(int result, ConnectJob* job) { RemoveConnectJob(job->key_handle()); if (result != OK) { + DCHECK(!socket.get()); callback->Run(result); // |group| is not necessarily valid after this. // |group| may be invalid after the callback, we need to search // |group_map_| again. diff --git a/net/socket/client_socket_pool_base.h b/net/socket/client_socket_pool_base.h index 8c4b3e7..b7df105 100644 --- a/net/socket/client_socket_pool_base.h +++ b/net/socket/client_socket_pool_base.h @@ -52,7 +52,8 @@ class ConnectJob { LoadState load_state() const { return load_state_; } const ClientSocketHandle* key_handle() const { return key_handle_; } - // Releases |socket_| to the client. + // Releases |socket_| to the client. On connection error, this should return + // NULL. ClientSocket* ReleaseSocket() { return socket_.release(); } // Begins connecting the socket. Returns OK on success, ERR_IO_PENDING if it diff --git a/net/socket/tcp_client_socket_pool.cc b/net/socket/tcp_client_socket_pool.cc index a5b5595..6b3fd05 100644 --- a/net/socket/tcp_client_socket_pool.cc +++ b/net/socket/tcp_client_socket_pool.cc @@ -114,6 +114,9 @@ int TCPConnectJob::DoTCPConnectComplete(int result) { base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), 100); + } else { + // Delete the socket on error. + set_socket(NULL); } return result; |