소스 검색

Resolved OpenVPN transmitted and received bytes issue, refreshed bytes on each connection

Khubaib 9 달 전
부모
커밋
ddff131732
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java

+ 6 - 0
app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java

@@ -303,6 +303,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
         double currentRxBytes = TrafficStats.getUidRxBytes(android.os.Process.myUid());
         double currentRxBytes = TrafficStats.getUidRxBytes(android.os.Process.myUid());
 
 
         Log.d("test_network_stat_IKev2", "MVT: currentTxBytes = " + currentTxBytes + " currentRxBytes = " + currentRxBytes);
         Log.d("test_network_stat_IKev2", "MVT: currentTxBytes = " + currentTxBytes + " currentRxBytes = " + currentRxBytes);
+        Log.d("test_network_stat_semi", "lastTxBytes: " + lastTxBytes + " lastRxBytes: " + lastRxBytes + " finalTxBytes:" + finalTxBytes + " finalRxBytes:" + finalRxBytes);
 
 
         double txBytes = currentTxBytes - lastTxBytes;
         double txBytes = currentTxBytes - lastTxBytes;
         double rxBytes = currentRxBytes - lastRxBytes;
         double rxBytes = currentRxBytes - lastRxBytes;
@@ -391,6 +392,11 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
 
 
         }
         }
 
 
+        lastRxBytes = 0.0;
+        lastTxBytes = 0.0;
+        finalRxBytes = 0.0;
+        finalTxBytes = 0.0;
+
         startTrafficMonitoring();
         startTrafficMonitoring();
         Date Today = Calendar.getInstance().getTime();
         Date Today = Calendar.getInstance().getTime();
         SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy");
         SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy");