[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [torbel/master] 4500 - check TorCtl.get_router return value
commit a0a63388e36c5384e4730e48555474fdf4566d72
Author: aagbsn <aagbsn@xxxxxxxx>
Date: Thu Nov 17 07:55:37 2011 -0800
4500 - check TorCtl.get_router return value
TorCtl.get_router can return None if no descriptor is found; added
a test before using.
---
controller.py | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/controller.py b/controller.py
index fe6dbf7..7bef189 100644
--- a/controller.py
+++ b/controller.py
@@ -647,10 +647,11 @@ class Controller(TorCtl.EventHandler):
try:
ns = self.conn.get_network_status("id/" + rid)[0]
router = self.conn.get_router(ns)
- self.add_to_cache(router)
- # Notify scheduler that a new router is available for testing.
- if self.scheduler:
- self.scheduler.new_descriptor(router)
+ if router:
+ self.add_to_cache(router)
+ # Notify scheduler that a new router is available for testing.
+ if self.scheduler:
+ self.scheduler.new_descriptor(router)
except TorCtl.ErrorReply, e:
log.error("NEWDESC: Controller error: %s", str(e))
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits