Prevent negative network speed

This commit is contained in:
M66B 2016-02-28 12:02:08 +01:00
parent bef0a659e4
commit 48e445b379
1 changed files with 4 additions and 0 deletions

View File

@ -684,6 +684,10 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
if (filter) {
ttx -= TrafficStats.getUidTxBytes(Process.myUid());
trx -= TrafficStats.getUidRxBytes(Process.myUid());
if (ttx < 0)
ttx = 0;
if (trx < 0)
trx = 0;
}
if (t > 0 && tx > 0 && rx > 0) {
float dt = (ct - t) / 1000f;