1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2025-01-03 05:44:14 +00:00

Reload on DNS change only

This commit is contained in:
M66B 2020-01-09 21:07:07 +01:00
parent f9462fc186
commit 97bf1c914e

View file

@ -2473,10 +2473,13 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
// Make sure the right DNS servers are being used
List<InetAddress> dns = linkProperties.getDnsServers();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ServiceSinkhole.this);
if (prefs.getBoolean("reload_onconnectivity", false) ||
(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !same(last_dns, dns))) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
? !same(last_dns, dns)
: prefs.getBoolean("reload_onconnectivity", false)) {
Log.i(TAG, "Changed link properties=" + linkProperties +
"DNS cur=" + TextUtils.join(",", dns) +
"DNS prv=" + (last_dns == null ? null : TextUtils.join(",", last_dns)));
last_dns = dns;
Log.i(TAG, "Changed link properties=" + linkProperties);
reload("link properties changed", ServiceSinkhole.this, false);
}
}