[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [flashproxy/js] Call the complete_callback only once.



commit 3859bdc7d66d62188b1869fa095d6d3f30b14e68
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Sat Mar 31 17:12:06 2012 -0700

    Call the complete_callback only once.
---
 flashproxy.js |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/flashproxy.js b/flashproxy.js
index e55e26b..78b40aa 100644
--- a/flashproxy.js
+++ b/flashproxy.js
@@ -360,6 +360,7 @@ function FlashProxy()
         this.c2r_schedule = [];
         this.r2c_schedule = [];
 
+        this.running = true;
         this.flush_timeout_id = null;
 
         /* This callback function can be overridden by external callers. */
@@ -390,8 +391,10 @@ function FlashProxy()
             log(ws.label + ": closed.");
             this.flush();
 
-            if (is_closed(this.client_s) && is_closed(this.relay_s))
+            if (this.running && is_closed(this.client_s) && is_closed(this.relay_s)) {
+                this.running = false;
                 this.complete_callback();
+            }
         }.bind(this);
 
         this.onmessage_client_to_relay = function(event) {



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits