فهرست منبع

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

Khubaib 8 ماه پیش
والد
کامیت
4f98988250
1فایلهای تغییر یافته به همراه8 افزوده شده و 4 حذف شده
  1. 8 4
      app/src/main/java/com/vpn/fastestvpnservice/utils/VPNConnectionsUtil.kt

+ 8 - 4
app/src/main/java/com/vpn/fastestvpnservice/utils/VPNConnectionsUtil.kt

@@ -378,6 +378,12 @@ class VPNConnectionsUtil: VpnStatus.StateListener {
                 if (isUp) {
                     App.tunnelStatus = Tunnel.State.UP
                     homeViewModel.setConnectState(App.CONNECTED)
+
+                    lastRxBytes = 0.0
+                    lastTxBytes = 0.0
+                    finalRxBytes = 0.0
+                    finalTxBytes = 0.0
+
                     startTrafficMonitoring()
                     Log.d("test_wg", "tunnelStatus if = ${App.tunnelStatus}")
 
@@ -745,10 +751,8 @@ class VPNConnectionsUtil: VpnStatus.StateListener {
         val currentTxBytes = TrafficStats.getUidTxBytes(Process.myUid()).toDouble()
         val currentRxBytes = TrafficStats.getUidRxBytes(Process.myUid()).toDouble()
 
-        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")
 
         val txBytes = currentTxBytes - lastTxBytes
         val rxBytes = currentRxBytes - lastRxBytes