Ticket #1780: 0001-Don-t-ignore-unknown-exceptions-raised-by-get_router.patch

File 0001-Don-t-ignore-unknown-exceptions-raised-by-get_router.patch, 1.1 KB (added by hbock, 9 years ago)

suggested patch

  • TorCtl.py

    From c281f68621715be9791950dc20c186fe2db1da49 Mon Sep 17 00:00:00 2001
    From: Harry Bock <hbock@ele.uri.edu>
    Date: Sun, 1 Aug 2010 21:18:23 -0400
    Subject: [PATCH 1/2] Don't ignore unknown exceptions raised by get_router.
    
    If an unknown exception is raised on one NS document during
    read_routers, it's very likely it's going to be raised again on the
    next, and the next... (e.g., TorCtlClosed).
    
    Instead of printing out the traceback and continuing, allow it to
    unwind the stack and let the caller handle it.
    ---
     TorCtl.py |    6 ++----
     1 files changed, 2 insertions(+), 4 deletions(-)
    
    diff --git a/TorCtl.py b/TorCtl.py
    index 3e3a034..6ed6d17 100755
    a b class Connection: 
    843843    for ns in nslist:
    844844      try:
    845845        r = self.get_router(ns)
    846         if r: new.append(r)
     846        if r:
     847          new.append(r)
    847848      except ErrorReply:
    848849        bad_key += 1
    849850        if "Running" in ns.flags:
    850851          plog("NOTICE", "Running router "+ns.nickname+"="
    851852             +ns.idhex+" has no descriptor")
    852       except:
    853         traceback.print_exception(*sys.exc_info())
    854         continue
    855853 
    856854    return new
    857855