Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1115)

Side by Side Diff: net/socket/client_socket_pool_base.cc

Issue 150205: Make ConnectJob::ReleaseSocket() return NULL on connection error. (Closed)
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/socket/client_socket_pool_base.h ('k') | net/socket/tcp_client_socket_pool.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/socket/client_socket_pool_base.h" 5 #include "net/socket/client_socket_pool_base.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 296
297 RequestMap* request_map = &group.connecting_requests; 297 RequestMap* request_map = &group.connecting_requests;
298 298
299 RequestMap::iterator it = request_map->find(job->key_handle()); 299 RequestMap::iterator it = request_map->find(job->key_handle());
300 CHECK(it != request_map->end()); 300 CHECK(it != request_map->end());
301 ClientSocketHandle* const handle = it->second.handle; 301 ClientSocketHandle* const handle = it->second.handle;
302 CompletionCallback* const callback = it->second.callback; 302 CompletionCallback* const callback = it->second.callback;
303 request_map->erase(it); 303 request_map->erase(it);
304 DCHECK_EQ(handle, job->key_handle()); 304 DCHECK_EQ(handle, job->key_handle());
305 305
306 scoped_ptr<ClientSocket> socket(job->ReleaseSocket()); 306 scoped_ptr<ClientSocket> socket(job->ReleaseSocket());
eroman 2009/07/02 05:01:13 I guess this no longer needs to be scoped_ptr. But
307 RemoveConnectJob(job->key_handle()); 307 RemoveConnectJob(job->key_handle());
308 308
309 if (result != OK) { 309 if (result != OK) {
310 DCHECK(!socket.get());
310 callback->Run(result); // |group| is not necessarily valid after this. 311 callback->Run(result); // |group| is not necessarily valid after this.
311 // |group| may be invalid after the callback, we need to search 312 // |group| may be invalid after the callback, we need to search
312 // |group_map_| again. 313 // |group_map_| again.
313 MaybeOnAvailableSocketSlot(group_name); 314 MaybeOnAvailableSocketSlot(group_name);
314 } else { 315 } else {
315 HandOutSocket(socket.release(), false /* not reused */, handle, &group); 316 HandOutSocket(socket.release(), false /* not reused */, handle, &group);
316 callback->Run(result); 317 callback->Run(result);
317 } 318 }
318 } 319 }
319 320
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 bool reused, 371 bool reused,
371 ClientSocketHandle* handle, 372 ClientSocketHandle* handle,
372 Group* group) { 373 Group* group) {
373 DCHECK(socket); 374 DCHECK(socket);
374 handle->set_socket(socket); 375 handle->set_socket(socket);
375 handle->set_is_reused(reused); 376 handle->set_is_reused(reused);
376 group->active_socket_count++; 377 group->active_socket_count++;
377 } 378 }
378 379
379 } // namespace net 380 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/client_socket_pool_base.h ('k') | net/socket/tcp_client_socket_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698