summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Resch <andrewresch@gmail.com>2009-01-05 10:14:12 +0000
committerAndrew Resch <andrewresch@gmail.com>2009-01-05 10:14:12 +0000
commit81b895bd1d98e21f515080e5483c471621e68390 (patch)
tree43e599d51437d3ea588ef1373ab7ee63f9e4efc2
parent2edf1fc6920d54cdf017f2f02415d941bd92a961 (diff)
downloaddeluge-81b895bd1d98e21f515080e5483c471621e68390.tar.gz
deluge-81b895bd1d98e21f515080e5483c471621e68390.tar.bz2
deluge-81b895bd1d98e21f515080e5483c471621e68390.zip
Fix the display of the tracker host when it's an IP address and not a
hostname
-rw-r--r--ChangeLog1
-rw-r--r--deluge/core/torrent.py10
2 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index c0668018d..b3d3a5c4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
Deluge 1.1.0_RC3 (05 January 2009)
Core:
* Fix applying proxy settings
+ * Fix the display of the tracker host when it's an IP address and not a hostname
GtkUI:
* Fix folder renaming to display the change properly
diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py
index 43072722d..8d2d219ec 100644
--- a/deluge/core/torrent.py
+++ b/deluge/core/torrent.py
@@ -519,6 +519,16 @@ class Torrent:
url = urlparse(tracker)
if hasattr(url, "hostname"):
host = (url.hostname or 'DHT')
+ # Check if hostname is an IP address and just return it if that's the case
+ import socket
+ try:
+ socket.inet_aton(url.hostname)
+ except socket.error:
+ pass
+ else:
+ # This is an IP address because an exception wasn't raised
+ return url.hostname
+
parts = host.split(".")
if len(parts) > 2:
if parts[-2] in ("co", "com"):