Index: chromecast/net/connectivity_checker.cc |
diff --git a/chromecast/net/connectivity_checker.cc b/chromecast/net/connectivity_checker.cc |
index 0c78b5d93aafe782076b476bde524ff87ed95366..4047770007c67fd60db9162ad00aba9c332e3521 100644 |
--- a/chromecast/net/connectivity_checker.cc |
+++ b/chromecast/net/connectivity_checker.cc |
@@ -60,12 +60,15 @@ void ConnectivityChecker::Initialize() { |
url_request_context_.reset(builder.Build()); |
net::NetworkChangeNotifier::AddConnectionTypeObserver(this); |
+ net::NetworkChangeNotifier::AddIPAddressObserver(this); |
loop_proxy_->PostTask(FROM_HERE, |
base::Bind(&ConnectivityChecker::Check, this)); |
} |
ConnectivityChecker::~ConnectivityChecker() { |
DCHECK(loop_proxy_.get()); |
+ net::NetworkChangeNotifier::RemoveIPAddressObserver(this); |
+ net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); |
loop_proxy_->DeleteSoon(FROM_HERE, url_request_context_.release()); |
loop_proxy_->DeleteSoon(FROM_HERE, url_request_.release()); |
} |
@@ -116,6 +119,7 @@ void ConnectivityChecker::Check() { |
void ConnectivityChecker::OnConnectionTypeChanged( |
net::NetworkChangeNotifier::ConnectionType type) { |
+ VLOG(2) << "OnConnectionTypeChanged " << type; |
if (type == net::NetworkChangeNotifier::CONNECTION_NONE) |
SetConnectivity(false); |
@@ -123,6 +127,13 @@ void ConnectivityChecker::OnConnectionTypeChanged( |
Check(); |
} |
+void ConnectivityChecker::OnIPAddressChanged() { |
+ VLOG(2) << "OnIPAddressChanged"; |
+ |
+ Cancel(); |
+ Check(); |
+} |
+ |
void ConnectivityChecker::OnResponseStarted(net::URLRequest* request) { |
int http_response_code = |
(request->status().is_success() && |