[tor-commits] [flashproxy/master] Don't use a separate num_proxy_pairs variable.

dcf at torproject.org dcf at torproject.org
Mon Jul 18 04:01:01 UTC 2011


commit b49755d365553fad2cf120a271e14bf276ac35bf
Author: David Fifield <david at bamsoftware.com>
Date:   Fri Jul 15 21:09:31 2011 +0000

    Don't use a separate num_proxy_pairs variable.
    
    Just use the length of the proxy_pairs array.
---
 swfcat.as |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/swfcat.as b/swfcat.as
index 9f0a4f7..c93c154 100644
--- a/swfcat.as
+++ b/swfcat.as
@@ -47,11 +47,7 @@ package
         /* UI shown when debug is off. */
         private var badge:Badge;
 
-        /* Number of proxy pairs currently connected (up to
-           MAX_NUM_PROXY_PAIRS). */
-        private var num_proxy_pairs:int = 0;
-        /* References to active proxy pairs, to prevent them from being
-           garbage collected. */
+        /* Proxy pairs currently connected (up to MAX_NUM_PROXY_PAIRS). */
         private var proxy_pairs:Array;
 
         private var fac_addr:Object;
@@ -140,7 +136,7 @@ package
             var fac_url:String;
             var loader:URLLoader;
 
-            if (num_proxy_pairs >= MAX_NUM_PROXY_PAIRS) {
+            if (proxy_pairs.length >= MAX_NUM_PROXY_PAIRS) {
                 setTimeout(proxy_main, FACILITATOR_POLL_INTERVAL);
                 return;
             }
@@ -197,14 +193,12 @@ package
             proxy_pairs.push(proxy_pair);
             proxy_pair.addEventListener(Event.COMPLETE, function(e:Event):void {
                 proxy_pair.log("Complete.");
-                num_proxy_pairs--;
                 /* Delete from the list of active proxy pairs. */
                 proxy_pairs.splice(proxy_pairs.indexOf(proxy_pair), 1);
                 badge.proxy_end();
             });
             proxy_pair.connect();
 
-            num_proxy_pairs++;
             badge.proxy_begin();
         }
 





More information about the tor-commits mailing list