Index: net/socket/client_socket_pool_base.h |
diff --git a/net/socket/client_socket_pool_base.h b/net/socket/client_socket_pool_base.h |
index 55ce7f7094dfa72ebc47e56252fd706a4b23e81d..23b293b76bcdcd21535c11ec9730b4ec6e561a93 100644 |
--- a/net/socket/client_socket_pool_base.h |
+++ b/net/socket/client_socket_pool_base.h |
@@ -225,7 +225,7 @@ class ClientSocketPoolBaseHelper |
return connect_job_factory_->ConnectionTimeout(); |
} |
- void enable_backup_jobs() { backup_jobs_enabled_ = true; }; |
+ void EnableBackupJobs() { backup_jobs_enabled_ = true; }; |
private: |
friend class base::RefCounted<ClientSocketPoolBaseHelper>; |
@@ -387,6 +387,13 @@ class ClientSocketPoolBaseHelper |
// Called when the backup socket timer fires. |
void OnBackupSocketTimerFired(const std::string& group_name); |
+ // Closes one idle socket. Picks the first one encountered. |
+ // TODO(willchan): Consider a better algorithm for doing this. Perhaps we |
+ // should keep an ordered list of idle sockets, and close them in order. |
+ // Requires maintaining more state. It's not clear if it's worth it since |
+ // I'm not sure if we hit this situation often. |
+ void CloseOneIdleSocket(); |
+ |
GroupMap group_map_; |
// Timer used to periodically prune idle sockets that timed out or can't be |
@@ -426,9 +433,13 @@ class ClientSocketPoolBaseHelper |
// |max_sockets_per_group_| limit. So choosing the next request involves |
// selecting the highest priority request across *all* groups. |
// |
- // Since reaching the maximum number of sockets is an edge case, we make note |
- // of when it happens, and thus avoid doing the slower "scan all groups" |
- // in the common case. |
+ // |may_have_stalled_group_| is not conclusive, since when we cancel pending |
+ // requests, we may reach the situation where we have the maximum number of |
+ // sockets, but not request is stalled because of the global socket limit |
+ // (although some requests may be blocked on the socket per group limit). |
+ // We don't strictly maintain |may_have_stalled_group_|, since that would |
+ // require a linear search through all groups in |group_map_| to see if one |
+ // of them is stalled. |
bool may_have_stalled_group_; |
const scoped_ptr<ConnectJobFactory> connect_job_factory_; |
@@ -568,7 +579,7 @@ class ClientSocketPoolBase { |
const std::string& name() const { return name_; } |
- void enable_backup_jobs() { helper_->enable_backup_jobs(); }; |
+ void EnableBackupJobs() { helper_->EnableBackupJobs(); }; |
private: |
// This adaptor class exists to bridge the |