mirror of https://github.com/M66B/NetGuard.git
Fixed not finding uids
This commit is contained in:
parent
6f7c19ec15
commit
86d8412b6c
|
@ -652,6 +652,22 @@ public class Packet {
|
||||||
return -1;
|
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 {
|
public static class Util {
|
||||||
private static final char[] hex = "0123456789ABCDEF".toCharArray();
|
private static final char[] hex = "0123456789ABCDEF".toCharArray();
|
||||||
|
|
||||||
|
|
|
@ -708,6 +708,7 @@ public class SinkholeService extends VpnService {
|
||||||
"/" + pkt.getDestinationPort() +
|
"/" + pkt.getDestinationPort() +
|
||||||
" " + pkt.getFlags() +
|
" " + pkt.getFlags() +
|
||||||
" " + pkt.getProtocol());
|
" " + pkt.getProtocol());
|
||||||
|
|
||||||
int connection;
|
int connection;
|
||||||
if (last_connected)
|
if (last_connected)
|
||||||
if (last_metered)
|
if (last_metered)
|
||||||
|
@ -716,6 +717,17 @@ public class SinkholeService extends VpnService {
|
||||||
connection = 1;
|
connection = 1;
|
||||||
else
|
else
|
||||||
connection = 0;
|
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(
|
new DatabaseHelper(SinkholeService.this).insertLog(
|
||||||
pkt.version,
|
pkt.version,
|
||||||
pkt.getDestinationAddress().toString(),
|
pkt.getDestinationAddress().toString(),
|
||||||
|
|
Loading…
Reference in New Issue