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

Unified Diff: net/socket/client_socket_pool_base.cc

Issue 981643002: Fix bug that would create unnecessary ConnectJobs in some cases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix stuff Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/client_socket_pool_base.h ('k') | 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 4bc44f5999eae784f7a7f4804d73928daa79e486..628fdd0d9e695b511c3a50e2d1e1867d67cc588f 100644
--- a/net/socket/client_socket_pool_base.cc
+++ b/net/socket/client_socket_pool_base.cc
@@ -226,7 +226,7 @@ bool ClientSocketPoolBaseHelper::IsStalled() const {
// which does not count.)
for (GroupMap::const_iterator it = group_map_.begin();
it != group_map_.end(); ++it) {
- if (it->second->IsStalledOnPoolMaxSockets(max_sockets_per_group_))
+ if (it->second->CanUseAdditionalSocketSlot(max_sockets_per_group_))
return true;
}
return false;
@@ -278,7 +278,7 @@ int ClientSocketPoolBaseHelper::RequestSocket(
// call back in to |this|, which will cause all sorts of fun and exciting
// re-entrancy issues if the socket pool is doing something else at the
// time.
- if (group->IsStalledOnPoolMaxSockets(max_sockets_per_group_)) {
+ if (group->CanUseAdditionalSocketSlot(max_sockets_per_group_)) {
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(
@@ -578,7 +578,7 @@ LoadState ClientSocketPoolBaseHelper::GetLoadState(
return max_state;
}
- if (group.IsStalledOnPoolMaxSockets(max_sockets_per_group_))
+ if (group.CanUseAdditionalSocketSlot(max_sockets_per_group_))
return LOAD_STATE_WAITING_FOR_STALLED_SOCKET_POOL;
return LOAD_STATE_WAITING_FOR_AVAILABLE_SOCKET;
}
@@ -632,9 +632,8 @@ base::DictionaryValue* ClientSocketPoolBaseHelper::GetInfoAsValue(
}
group_dict->Set("connect_jobs", connect_jobs_list);
- group_dict->SetBoolean("is_stalled",
- group->IsStalledOnPoolMaxSockets(
- max_sockets_per_group_));
+ group_dict->SetBoolean("is_stalled", group->CanUseAdditionalSocketSlot(
+ max_sockets_per_group_));
group_dict->SetBoolean("backup_job_timer_is_running",
group->BackupJobTimerIsRunning());
@@ -836,7 +835,7 @@ bool ClientSocketPoolBaseHelper::FindTopStalledGroup(
Group* curr_group = i->second;
if (!curr_group->has_pending_requests())
continue;
- if (curr_group->IsStalledOnPoolMaxSockets(max_sockets_per_group_)) {
+ if (curr_group->CanUseAdditionalSocketSlot(max_sockets_per_group_)) {
if (!group)
return true;
has_stalled_group = true;
@@ -960,6 +959,15 @@ void ClientSocketPoolBaseHelper::ProcessPendingRequest(
const std::string& group_name, Group* group) {
const Request* next_request = group->GetNextPendingRequest();
DCHECK(next_request);
+
+ // If the group has no idle sockets, and can't make use of an additional slot,
+ // either because it's at the limit or because it's at the socket per group
+ // limit, then there's nothing to do.
+ if (group->idle_sockets().empty() &&
+ !group->CanUseAdditionalSocketSlot(max_sockets_per_group_)) {
+ return;
+ }
+
int rv = RequestSocketInternal(group_name, *next_request);
if (rv != ERR_IO_PENDING) {
scoped_ptr<const Request> request = group->PopNextPendingRequest();
« no previous file with comments | « net/socket/client_socket_pool_base.h ('k') | net/socket/client_socket_pool_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698