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

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



commit 653ce38bfb7ac03722db9e58b3121e9fff356698
Author: aagbsn <aagbsn@xxxxxxxx>
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)

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