[tor-commits] [flashproxy/master] Call flush while any data is buffered.

dcf at torproject.org dcf at torproject.org
Mon Apr 9 04:08:43 UTC 2012


commit a9491dd508f8bf1fe11a371f99b332bafd428743
Author: David Fifield <david at bamsoftware.com>
Date:   Sat Apr 7 04:44:46 2012 -0700

    Call flush while any data is buffered.
    
    This is so that an open socket can be closed after sending all its data,
    after its partner has closed.
---
 flashproxy.js |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/flashproxy.js b/flashproxy.js
index 726b3ee..bbadc46 100644
--- a/flashproxy.js
+++ b/flashproxy.js
@@ -582,7 +582,8 @@ function ProxyPair(client_addr, relay_addr, rate_limit) {
             this.relay_s.close();
         }
 
-        if (this.r2c_schedule.length > 0 || this.c2r_schedule.length > 0)
+        if (this.r2c_schedule.length > 0 || this.client_s.bufferedAmount > 0
+            || this.c2r_schedule.length > 0 || this.relay_s.bufferedAmount > 0)
             this.flush_timeout_id = setTimeout(this.flush.bind(this), this.rate_limit.when() * 1000);
     };
 }





More information about the tor-commits mailing list