[tor-commits] [flashproxy/master] Print "read" log messages only in debugging mode.

dcf at torproject.org dcf at torproject.org
Sun Jul 24 03:26:56 UTC 2011


commit 06d95087533353642e8c733d82db64c4ba1193d4
Author: David Fifield <david at bamsoftware.com>
Date:   Sat Jul 23 01:25:01 2011 +0000

    Print "read" log messages only in debugging mode.
---
 ProxyPair.as |    8 +++++++-
 swfcat.as    |    6 +++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ProxyPair.as b/ProxyPair.as
index 2b66532..10c4263 100644
--- a/ProxyPair.as
+++ b/ProxyPair.as
@@ -42,6 +42,12 @@ package
                 ui.puts(msg)
         }
 
+        public function logdebug(msg:String):void
+        {
+            if (ui.debug)
+                log(msg);
+        }
+
         public function set_name(name:String):void
         {
             this.name = name;
@@ -129,7 +135,7 @@ package
             s_to.writeBytes(bytes);
             s_to.flush();
             ui.rate_limit.update(n);
-            log(label + ": read " + bytes.length + ".");
+            logdebug(label + ": read " + bytes.length + ".");
         }
 
         /* Send as much data as the rate limit currently allows. */
diff --git a/swfcat.as b/swfcat.as
index 9f3f967..73f3760 100644
--- a/swfcat.as
+++ b/swfcat.as
@@ -54,6 +54,8 @@ package
         
         private var local_addr:Object;
 
+        public var debug:Boolean;
+
         public var rate_limit:RateLimit;
 
         public function puts(s:String):void
@@ -85,7 +87,9 @@ package
 
         private function loaderinfo_complete(e:Event):void
         {
-            if (this.loaderInfo.parameters["debug"] || this.loaderInfo.parameters["client"]) {
+            debug = this.loaderInfo.parameters["debug"];
+
+            if (debug || this.loaderInfo.parameters["client"]) {
                 output_text = new TextField();
                 output_text.width = stage.stageWidth;
                 output_text.height = stage.stageHeight;





More information about the tor-commits mailing list