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 b008c54378c3d8f2b1db98bdc602439c92fd1483..99011bed65aa8e7b70ce60879d7f7ee8ea7c5ab0 100644 |
--- a/net/socket/client_socket_pool_base.cc |
+++ b/net/socket/client_socket_pool_base.cc |
@@ -112,7 +112,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, |
+ NetworkChangeNotifier* network_change_notifier) |
: idle_socket_count_(0), |
connecting_socket_count_(0), |
handed_out_socket_count_(0), |
@@ -123,10 +124,14 @@ ClientSocketPoolBaseHelper::ClientSocketPoolBaseHelper( |
used_idle_socket_timeout_(used_idle_socket_timeout), |
may_have_stalled_group_(false), |
connect_job_factory_(connect_job_factory), |
+ network_change_notifier_(network_change_notifier), |
backup_jobs_enabled_(false), |
ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { |
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() { |
@@ -138,6 +143,9 @@ ClientSocketPoolBaseHelper::~ClientSocketPoolBaseHelper() { |
CloseIdleSockets(); |
CHECK(group_map_.empty()); |
DCHECK_EQ(0, connecting_socket_count_); |
+ |
+ if (network_change_notifier_) |
+ network_change_notifier_->RemoveObserver(this); |
} |
// InsertRequestIntoQueue inserts the request into the queue based on |
@@ -602,6 +610,10 @@ void ClientSocketPoolBaseHelper::OnConnectJobComplete( |
} |
} |
+void ClientSocketPoolBaseHelper::OnIPAddressChanged() { |
+ CloseIdleSockets(); |
+} |
+ |
void ClientSocketPoolBaseHelper::RemoveConnectJob(const ConnectJob *job, |
Group* group) { |
CHECK_GT(connecting_socket_count_, 0); |