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

Unified Diff: net/socket/client_socket_pool_base.cc

Issue 5523001: Fix ClientSocketPoolBaseHelper preconnect crasher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add NOTREACHED(). Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/socket/client_socket_pool_base_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/client_socket_pool_base.cc
diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc
index 02ac58710b5a6e52abbd4ef3c2d5bb7c0dbb4bbd..4f042bbf19cbd8c7d58cc439a9110ef1f27f9bb1 100644
--- a/net/socket/client_socket_pool_base.cc
+++ b/net/socket/client_socket_pool_base.cc
@@ -243,17 +243,29 @@ void ClientSocketPoolBaseHelper::RequestSockets(
Group* group = GetOrCreateGroup(group_name);
+ // RequestSocketsInternal() may delete the group.
+ bool deleted_group = false;
+
for (int num_iterations_left = num_sockets;
group->NumActiveSocketSlots() < num_sockets &&
num_iterations_left > 0 ; num_iterations_left--) {
int rv = RequestSocketInternal(group_name, &request);
if (rv < 0 && rv != ERR_IO_PENDING) {
// We're encountering a synchronous error. Give up.
+ if (!ContainsKey(group_map_, group_name))
+ deleted_group = true;
+ break;
+ }
+ if (!ContainsKey(group_map_, group_name)) {
+ // Unexpected. The group should only be getting deleted on synchronous
+ // error.
+ NOTREACHED();
+ deleted_group = true;
break;
}
}
- if (group->IsEmpty())
+ if (!deleted_group && group->IsEmpty())
RemoveGroup(group_name);
request.net_log().EndEvent(
« no previous file with comments | « no previous file | net/socket/client_socket_pool_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698