diff options
Diffstat (limited to 'net/socket/client_socket_pool_base.cc')
-rw-r--r-- | net/socket/client_socket_pool_base.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc index 9701937..44e2187 100644 --- a/net/socket/client_socket_pool_base.cc +++ b/net/socket/client_socket_pool_base.cc @@ -100,7 +100,8 @@ ClientSocketPoolBaseHelper::ClientSocketPoolBaseHelper( int max_sockets_per_group, base::TimeDelta unused_idle_socket_timeout, base::TimeDelta used_idle_socket_timeout, - ConnectJobFactory* connect_job_factory) + ConnectJobFactory* connect_job_factory, + const scoped_refptr<NetworkChangeNotifier>& network_change_notifier) : idle_socket_count_(0), connecting_socket_count_(0), handed_out_socket_count_(0), @@ -109,9 +110,13 @@ ClientSocketPoolBaseHelper::ClientSocketPoolBaseHelper( unused_idle_socket_timeout_(unused_idle_socket_timeout), used_idle_socket_timeout_(used_idle_socket_timeout), may_have_stalled_group_(false), - connect_job_factory_(connect_job_factory) { + connect_job_factory_(connect_job_factory), + network_change_notifier_(network_change_notifier) { DCHECK_LE(0, max_sockets_per_group); DCHECK_LE(max_sockets_per_group, max_sockets); + + if (network_change_notifier_) + network_change_notifier_->AddObserver(this); } ClientSocketPoolBaseHelper::~ClientSocketPoolBaseHelper() { @@ -123,6 +128,9 @@ ClientSocketPoolBaseHelper::~ClientSocketPoolBaseHelper() { CloseIdleSockets(); DCHECK(group_map_.empty()); DCHECK(connect_job_map_.empty()); + + if (network_change_notifier_) + network_change_notifier_->RemoveObserver(this); } // InsertRequestIntoQueue inserts the request into the queue based on @@ -522,6 +530,10 @@ void ClientSocketPoolBaseHelper::OnConnectJobComplete( } } +void ClientSocketPoolBaseHelper::OnIPAddressChanged() { + CloseIdleSockets(); +} + void ClientSocketPoolBaseHelper::EnableLateBindingOfSockets(bool enabled) { g_late_binding = enabled; } |