Commit 8e12ae06 authored by willchan@chromium.org's avatar willchan@chromium.org

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
parent 78a3a6f8
......@@ -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.
......
......@@ -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
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment