[tor-commits] [arm/master] Removing manual descriptor parsing from getRelayNickname()

atagar at torproject.org atagar at torproject.org
Sun Jun 2 03:14:48 UTC 2013


commit 7c6752d998690a1d3e4ec271a856a83a20199c4e
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Jun 1 19:50:01 2013 -0700

    Removing manual descriptor parsing from getRelayNickname()
    
    The getRelayNickname() method did a little manual parsing of router status
    entries to get the nickname. Replacing this with a call to our controller's
    get_network_status().
---
 src/util/torTools.py |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/util/torTools.py b/src/util/torTools.py
index a603f21..0cfa13c 100644
--- a/src/util/torTools.py
+++ b/src/util/torTools.py
@@ -757,13 +757,10 @@ class Controller:
           myNickname = self.getOption("Nickname", "Unnamed")
           self._nicknameLookupCache[relayFingerprint] = myNickname
         else:
-          # check the consensus for the relay
-          nsEntry = self.getConsensusEntry(relayFingerprint)
+          nsEntry = self.controller.get_network_status(relayFingerprint, None)
           
-          if nsEntry: relayNickname = nsEntry[2:nsEntry.find(" ", 2)]
-          else: relayNickname = None
-          
-          self._nicknameLookupCache[relayFingerprint] = relayNickname
+          if nsEntry:
+            self._nicknameLookupCache[relayFingerprint] = nsEntry.nickname
       
       result = self._nicknameLookupCache[relayFingerprint]
     





More information about the tor-commits mailing list