commit 7c6752d998690a1d3e4ec271a856a83a20199c4e Author: Damian Johnson atagar@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]
tor-commits@lists.torproject.org