mirror of
https://github.com/M66B/NetGuard.git
synced 2025-02-24 07:10:50 +00:00
Use max expiry on conflict, improvements
This commit is contained in:
parent
fcafb8b43e
commit
85c77cc6af
2 changed files with 5 additions and 3 deletions
|
@ -739,7 +739,6 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||
db.beginTransactionNonExclusive();
|
||||
try {
|
||||
int ttl = rr.TTL;
|
||||
// Android caches DNS for 15 minutes
|
||||
if (ttl < 15 * 60)
|
||||
ttl = 15 * 60;
|
||||
|
||||
|
@ -834,7 +833,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||
// There is a segmented index on qname
|
||||
String query = "SELECT ID AS _id, *";
|
||||
query += " FROM dns";
|
||||
query += " ORDER BY qname";
|
||||
query += " ORDER BY qname, resource";
|
||||
return db.rawQuery(query, new String[]{});
|
||||
} finally {
|
||||
mLock.readLock().unlock();
|
||||
|
|
|
@ -1300,8 +1300,11 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|||
if (!exists || !mapUidIPFilters.get(key).get(iname).block) {
|
||||
IPRule rule = new IPRule(block, time + ttl);
|
||||
mapUidIPFilters.get(key).put(iname, rule);
|
||||
} else if (exists)
|
||||
} else if (exists) {
|
||||
IPRule rule = mapUidIPFilters.get(key).get(iname);
|
||||
rule.expires = Math.max(rule.expires, time + ttl);
|
||||
Log.w(TAG, "Address conflict uid=" + uid + " " + daddr + " " + dresource + "/" + dport);
|
||||
}
|
||||
} else
|
||||
Log.w(TAG, "Address not numeric " + name);
|
||||
} catch (UnknownHostException ex) {
|
||||
|
|
Loading…
Reference in a new issue