[tor-commits] [flashproxy/master] Don't close the other half of the proxy pair if there is buffered data.

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


commit b724fe09e39f90eade0f42ac8f5b3ec6da2a9751
Author: David Fifield <david at bamsoftware.com>
Date:   Sat Apr 7 02:25:04 2012 -0700

    Don't close the other half of the proxy pair if there is buffered data.
---
 flashproxy.js |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/flashproxy.js b/flashproxy.js
index 4e42106..726b3ee 100644
--- a/flashproxy.js
+++ b/flashproxy.js
@@ -573,11 +573,11 @@ function ProxyPair(client_addr, relay_addr, rate_limit) {
             }
         }
 
-        if (is_closed(this.relay_s) && !is_closed(this.client_s) && this.r2c_schedule.length === 0) {
+        if (is_closed(this.relay_s) && !is_closed(this.client_s) && this.client_s.bufferedAmount === 0 && this.r2c_schedule.length === 0) {
             log("Client: closing.");
             this.client_s.close();
         }
-        if (is_closed(this.client_s) && !is_closed(this.relay_s) && this.c2r_schedule.length === 0) {
+        if (is_closed(this.client_s) && !is_closed(this.relay_s) && this.relay_s.bufferedAmount === 0 && this.c2r_schedule.length === 0) {
             log("Relay: closing.");
             this.relay_s.close();
         }





More information about the tor-commits mailing list