Fixed not finding uids

This commit is contained in:
M66B 2016-01-08 18:21:45 +01:00
parent 6f7c19ec15
commit 86d8412b6c
2 changed files with 28 additions and 0 deletions

View File

@ -652,6 +652,22 @@ public class Packet {
return -1;
}
private void dump(String name) {
File file = new File(name);
Scanner scanner = null;
try {
scanner = new Scanner(file);
while (scanner.hasNextLine()) {
Log.d(TAG, scanner.nextLine());
}
} catch (FileNotFoundException ex) {
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
} finally {
if (scanner != null)
scanner.close();
}
}
public static class Util {
private static final char[] hex = "0123456789ABCDEF".toCharArray();

View File

@ -708,6 +708,7 @@ public class SinkholeService extends VpnService {
"/" + pkt.getDestinationPort() +
" " + pkt.getFlags() +
" " + pkt.getProtocol());
int connection;
if (last_connected)
if (last_metered)
@ -716,6 +717,17 @@ public class SinkholeService extends VpnService {
connection = 1;
else
connection = 0;
int tries = 0;
int uid = pkt.getUid();
while (uid < 0 && tries < 10) {
Thread.sleep(10);
tries++;
uid = pkt.getUid();
if (uid >= 0)
Log.w(TAG, "Uid found after try=" + tries);
}
new DatabaseHelper(SinkholeService.this).insertLog(
pkt.version,
pkt.getDestinationAddress().toString(),