[tor-commits] [flashproxy/master] Add a dummy should_disable function.

dcf at torproject.org dcf at torproject.org
Sun Sep 4 21:38:54 UTC 2011


commit 25e2e026ede28979b5cdf32a2678f241f5a1fbf2
Author: David Fifield <david at bamsoftware.com>
Date:   Sun Sep 4 13:27:54 2011 -0700

    Add a dummy should_disable function.
    
    This function controls whether the flash proxy will disable itself,
    which we'll do roughly whenever we're running on a mobile browser.
---
 swfcat.as |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/swfcat.as b/swfcat.as
index 73f3760..8742bce 100644
--- a/swfcat.as
+++ b/swfcat.as
@@ -134,12 +134,25 @@ package
                 return default_addr;
         }
 
+        /* Are circumstances such that we should self-disable and not be a
+           proxy? We take a best-effort guess as to whether this device runs on
+           a battery or the data transfer might be expensive. */
+        private function should_disable():Boolean
+        {
+            return false;
+        }
+
         /* The main logic begins here, after start-up issues are taken care of. */
         private function proxy_main():void
         {
             var fac_url:String;
             var loader:URLLoader;
 
+            if (should_disable()) {
+                puts("Disabling self.");
+                return;
+            }
+
             if (proxy_pairs.length >= MAX_NUM_PROXY_PAIRS) {
                 setTimeout(proxy_main, FACILITATOR_POLL_INTERVAL);
                 return;





More information about the tor-commits mailing list