[tor-commits] [torbel/master] 4503 - catch ErrorReply

sebastian at torproject.org sebastian at torproject.org
Thu Nov 17 17:10:49 UTC 2011


commit 653ce38bfb7ac03722db9e58b3121e9fff356698
Author: aagbsn <aagbsn at extc.org>
Date:   Thu Nov 17 08:52:20 2011 -0800

    4503 - catch ErrorReply
    
    TorCtl may raise an ErrorReply when we try to close a stream that
    is not ours. TorBEL will now catch the exception and log the error
    message
---
 controller.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/controller.py b/controller.py
index fe6dbf7..b94c79e 100644
--- a/controller.py
+++ b/controller.py
@@ -853,6 +853,12 @@ class Controller(TorCtl.EventHandler):
                 except TorCtl.TorCtlClosed:
                     # Bail if we closed.
                     return
+                except TorCtl.ErrorReply, e:
+                    # We can receive "552 Unknown stream" if Tor pukes on the stream
+                    # before we actually receive the event and use it.
+                    log.error("(%s, %d): Error attaching stream!",
+                              router.nickname, event.target_port)  
+                    return
 
                 if narrow:
                     self.narrow(stream.router, event.target_port)



More information about the tor-commits mailing list