[or-cvs] r20100: {arm} Fixed missing import and provides warning when geoip databas (arm/trunk/interface)
atagar at seul.org
atagar at seul.org
Tue Jul 21 11:18:44 UTC 2009
Author: atagar
Date: 2009-07-21 07:18:43 -0400 (Tue, 21 Jul 2009)
New Revision: 20100
Modified:
arm/trunk/interface/connPanel.py
Log:
Fixed missing import and provides warning when geoip database is unavailable (thanks to SwissTorExit and karsten).
Modified: arm/trunk/interface/connPanel.py
===================================================================
--- arm/trunk/interface/connPanel.py 2009-07-21 09:46:18 UTC (rev 20099)
+++ arm/trunk/interface/connPanel.py 2009-07-21 11:18:43 UTC (rev 20100)
@@ -3,6 +3,7 @@
# Released under the GPL v3 (http://www.gnu.org/licenses/gpl.html)
import os
+import socket
import curses
from TorCtl import TorCtl
@@ -97,6 +98,7 @@
self.nicknameLookupCache = {} # chache of (ip, port) -> nickname
self.fingerprintMappings = _getFingerprintMappings(self.conn) # mappings of ip -> [(port, OR identity), ...]
self.nickname = self.conn.get_option("Nickname")[0][1]
+ self.providedGeoipWarning = False
self.isCursorEnabled = True
self.cursorSelection = None
@@ -191,7 +193,11 @@
try:
countryCodeQuery = "ip-to-country/%s" % foreign[:foreign.find(":")]
countryCode = self.conn.get_info(countryCodeQuery)[countryCodeQuery]
- except socket.error: countryCode = "??"
+ except socket.error:
+ countryCode = "??"
+ if not self.providedGeoipWarning:
+ self.logger.monitor_event("WARN", "Tor geoip database is unavailable.")
+ self.providedGeoipWarning = True
self.connections.append((type, localIP, localPort, foreignIP, foreignPort, countryCode))
except IOError:
More information about the tor-commits
mailing list