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

[tor-commits] [flashproxy/master] Catch sendall socket errors.



commit c752358b3506e45bcfee7d968e48350bb3e6d096
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Sun Apr 8 10:23:55 2012 -0700

    Catch sendall socket errors.
---
 connector.py |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/connector.py b/connector.py
index 97d48b1..d000a54 100755
--- a/connector.py
+++ b/connector.py
@@ -601,7 +601,12 @@ def proxy_chunk_local_to_remote(local, remote, data = None):
         remote.close()
         return False
     else:
-        remote.send_chunk(data)
+        try:
+            remote.send_chunk(data)
+        except socket.error, e:
+            log(u"Socket error writing to remote: %s" % repr(str(e)))
+            local.close()
+            return False
         return True
 
 def proxy_chunk_remote_to_local(remote, local, data = None):
@@ -634,7 +639,12 @@ def proxy_chunk_remote_to_local(remote, local, data = None):
                 remote.close()
                 local.close()
                 return False
-            local.send_chunk(data)
+            try:
+                local.send_chunk(data)
+            except socket.error, e:
+                log(u"Socket error writing to local: %s" % repr(str(e)))
+                remote.close()
+                return False
         return True
 
 def receive_unlinked(fd, label):



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