Fixed updating uid/IP map

This commit is contained in:
M66B 2016-02-03 19:35:12 +01:00
parent e186d5a7c6
commit 836000529a
1 changed files with 2 additions and 17 deletions

View File

@ -955,35 +955,20 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
}
private void updateUidIPFilters() {
Map<Integer, Map<Integer, Map<InetAddress, Boolean>>> map = new HashMap<>();
DatabaseHelper dh = new DatabaseHelper(SinkholeService.this);
Cursor cursor = dh.getAccess();
int colDAddr = cursor.getColumnIndex("daddr");
while (cursor.moveToNext()) {
String daddr = cursor.getString(colDAddr);
try {
for (InetAddress iaddr : InetAddress.getAllByName(daddr)) {
ResourceRecord rr = new ResourceRecord();
rr.Time = new Date().getTime();
rr.QName = daddr;
rr.AName = daddr;
rr.Resource = iaddr.getHostAddress();
rr.TTL = 10 * 60; // Android default
dh.insertDns(rr);
}
// This will result in native callbacks
InetAddress.getAllByName(daddr);
} catch (UnknownHostException ex) {
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
}
}
cursor.close();
dh.close();
synchronized (mapUidIPFilters) {
mapUidIPFilters = map;
}
}
private void cleanupDNS() {