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

[tor-commits] [pytorctl/master] Removing socket timeout for thread wakeup



commit 42b5f0e536089a0a509bac0403155466881b7c2f
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Thu Jun 16 18:45:57 2011 -0700

    Removing socket timeout for thread wakeup
    
    The shutdown added in this branch wakes the socket so there's no need for the
    loop we previously had.
---
 TorUtil.py |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/TorUtil.py b/TorUtil.py
index 60d2b2f..82c2a12 100644
--- a/TorUtil.py
+++ b/TorUtil.py
@@ -188,10 +188,6 @@ def unescape_dots(s, translate_nl=1):
 # XXX: Exception handling
 class BufSock:
   def __init__(self, s):
-    # sets a timeout on our recv operations
-    s.settimeout(0.02)
-    self._isDone = False
-
     self._s = s
     self._buf = []
 
@@ -204,10 +200,7 @@ class BufSock:
         return result
 
     while 1:
-      try:
-        s = self._s.recv(128)
-      except socket.timeout:
-        if not self._isDone: continue
+      s = self._s.recv(128)
 
       if not s: return None
       # XXX: This really does need an exception
@@ -229,7 +222,6 @@ class BufSock:
     self._s.send(s)
 
   def close(self):
-    self._isDone = True
     self._s.shutdown(socket.SHUT_RDWR)
     self._s.close()
 



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