Browse Source

Disable onBytesTransferred by default in PsiphonTunnel.java

- Added comment for enabling bytes transfered stats in PsiphonTunnel.java
efryntov 1 year ago
parent
commit
5df4996174
1 changed files with 8 additions and 2 deletions
  1. 8 2
      MobileLibrary/Android/PsiphonTunnel/PsiphonTunnel.java

+ 8 - 2
MobileLibrary/Android/PsiphonTunnel/PsiphonTunnel.java

@@ -105,6 +105,14 @@ public class PsiphonTunnel {
         default void onClientIsLatestVersion() {}
         default void onSplitTunnelRegions(List<String> regions) {}
         default void onUntunneledAddress(String address) {}
+        /**
+         * Called to report how many bytes have been transferred since the last time
+         * this function was called.
+         * By default onBytesTransferred is disabled. Enable it by setting
+         * EmitBytesTransferred to true in the Psiphon config.
+         * @param sent The number of bytes sent since the last call to onBytesTransferred.
+         * @param received The number of bytes received since the last call to onBytesTransferred.
+         */
         default void onBytesTransferred(long sent, long received) {}
         default void onStartedWaitingForNetworkConnectivity() {}
         default void onStoppedWaitingForNetworkConnectivity() {}
@@ -743,8 +751,6 @@ public class PsiphonTunnel {
             json.put("EstablishTunnelTimeoutSeconds", 0);
         }
 
-        json.put("EmitBytesTransferred", true);
-
         if (localSocksProxyPort != 0 && (!json.has("LocalSocksProxyPort") || json.getInt(
                 "LocalSocksProxyPort") == 0)) {
             // When mLocalSocksProxyPort is set, tun2socks is already configured