mirror of https://github.com/M66B/NetGuard.git
Limit number of notified IP addresses to 7
This commit is contained in:
parent
12d87bc4f1
commit
c56ba04df8
|
@ -670,7 +670,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public Cursor getAccessUnset(int uid) {
|
||||
public Cursor getAccessUnset(int uid, int limit) {
|
||||
mLock.readLock().lock();
|
||||
try {
|
||||
SQLiteDatabase db = this.getReadableDatabase();
|
||||
|
@ -682,6 +682,8 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
|||
query += " AND block < 0";
|
||||
query += " GROUP BY daddr, allowed";
|
||||
query += " ORDER BY time DESC";
|
||||
if (limit > 0)
|
||||
query += " LIMIT " + limit;
|
||||
return db.rawQuery(query, new String[]{Integer.toString(uid)});
|
||||
} finally {
|
||||
mLock.readLock().unlock();
|
||||
|
|
|
@ -1960,7 +1960,7 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
|
|||
sp.setSpan(new StyleSpan(Typeface.BOLD), pos, pos + name.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
notification.addLine(sp);
|
||||
|
||||
Cursor cursor = DatabaseHelper.getInstance(SinkholeService.this).getAccessUnset(uid);
|
||||
Cursor cursor = DatabaseHelper.getInstance(SinkholeService.this).getAccessUnset(uid, 7);
|
||||
int colDAddr = cursor.getColumnIndex("daddr");
|
||||
int colTime = cursor.getColumnIndex("time");
|
||||
int colAllowed = cursor.getColumnIndex("allowed");
|
||||
|
|
Loading…
Reference in New Issue