Index: chromecast/net/connectivity_checker.cc |
diff --git a/chromecast/net/connectivity_checker.cc b/chromecast/net/connectivity_checker.cc |
index 0c78b5d93aafe782076b476bde524ff87ed95366..8dce954e94fb40ee5adda4bd5010b76e5b4c06fb 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::RemoveConnectionTypeObserver(this); |
+ net::NetworkChangeNotifier::RemoveIPAddressObserver(this); |
byungchul
2015/03/11 17:18:03
reverse the order.
wzhong
2015/03/11 17:38:20
Done.
|
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,14 @@ void ConnectivityChecker::OnConnectionTypeChanged( |
Check(); |
} |
+void ConnectivityChecker::OnIPAddressChanged() { |
+ VLOG(2) << "OnIPAddressChanged"; |
+ |
+ SetConnectivity(false); |
byungchul
2015/03/11 17:18:03
Please comment why it sets connectivity false. Sho
derekjchow1
2015/03/11 17:25:00
Don't SetConnectivity here since NetworkChangeNoti
wzhong
2015/03/11 17:38:20
Removed. Triggering a connectivity checking is suf
|
+ Cancel(); |
+ Check(); |
+} |
+ |
void ConnectivityChecker::OnResponseStarted(net::URLRequest* request) { |
int http_response_code = |
(request->status().is_success() && |