[tor-commits] [flashproxy/master] Fix switched sends of initial buffered data.

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

commit 6818aa5081677e2b6d09401845649f9e10431c50
Author: David Fifield <david at bamsoftware.com>
Date:   Sat Apr 7 19:52:54 2012 -0700

    Fix switched sends of initial buffered data.
    The buffer of the local socket was being sent to the remote socket and
    vice versa. Practically, this only caused a problem when the buffers
    were non-empty, which happened when the local Tor connected before any
    remote proxy.
 connector.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/connector.py b/connector.py
index a4c810b..97d48b1 100755
--- a/connector.py
+++ b/connector.py
@@ -670,10 +670,10 @@ def match_proxies():
         log(u"Linking %s and %s." % (format_peername(local), format_peername(remote)))
         remote.partner = local
         local.partner = remote
-        if local.buf:
-            proxy_chunk_remote_to_local(remote, local, local.buf)
         if remote.buf:
-            proxy_chunk_local_to_remote(local, remote, remote.buf)
+            proxy_chunk_remote_to_local(remote, local, remote.buf)
+        if local.buf:
+            proxy_chunk_local_to_remote(local, remote, local.buf)
 class TimeoutSocket(object):
     def __init__(self, fd):

More information about the tor-commits mailing list