Author: andar
Revision: 5054
Log:
Fix displaying IPv6 peers in the Peers tab
Diff:
Modified: branches/1.1.0_RC/ChangeLog
===================================================================
--- branches/1.1.0_RC/ChangeLog 2009-04-12 20:07:41 UTC (rev 5053)
+++ branches/1.1.0_RC/ChangeLog 2009-04-13 18:02:49 UTC (rev 5054)
@@ -2,6 +2,7 @@
==== GtkUI ====
* Fix #883 segfault if locale is not using UTF-8 encoding
* Fix for adding torrents with invalid filename encodings
+ * Fix displaying IPv6 peers in the Peers tab
=== Deluge 1.1.6 - (06 April 2009) ===
==== Core ====
Modified: branches/1.1.0_RC/deluge/ui/gtkui/peers_tab.py
===================================================================
--- branches/1.1.0_RC/deluge/ui/gtkui/peers_tab.py 2009-04-12 20:07:41 UTC
(rev 5053)
+++ branches/1.1.0_RC/deluge/ui/gtkui/peers_tab.py 2009-04-13 18:02:49 UTC
(rev 5054)
@@ -73,7 +73,7 @@
self.listview = glade.get_widget("peers_listview")
self.listview.connect("button-press-event",
self._on_button_press_event)
# country pixbuf, ip, client, downspeed, upspeed, country code,
int_ip, seed/peer icon, progress
- self.liststore = gtk.ListStore(gtk.gdk.Pixbuf, str, str, int, int,
str, gobject.TYPE_UINT, gtk.gdk.Pixbuf, float)
+ self.liststore = gtk.ListStore(gtk.gdk.Pixbuf, str, str, int, int,
str, float, gtk.gdk.Pixbuf, float)
self.cached_flag_pixbufs = {}
self.seed_pixbuf =
gtk.gdk.pixbuf_new_from_file(deluge.common.get_pixmap("seeding16.png"))
@@ -308,8 +308,17 @@
# Peer is not in list so we need to add it
# Create an int IP address for sorting purposes
- ip_int = sum([int(byte) << shift
- for byte, shift in
izip(peer["ip"].split(":")[0].split("."), (24, 16, 8, 0))])
+ if peer["ip"].count(":") == 1:
+ # This is an IPv4 address
+ ip_int = sum([int(byte) << shift
+ for byte, shift in
izip(peer["ip"].split(":")[0].split("."), (24, 16, 8, 0))])
+ else:
+ # This is an IPv6 address
+ import socket
+ import binascii
+ # Split out the :port
+ ip = ":".join(peer["ip"].split(":")[:-1])
+ ip_int =
long(binascii.hexlify(socket.inet_pton(socket.AF_INET6, ip)), 16)
if peer["seed"]:
icon = self.seed_pixbuf
@@ -323,7 +332,7 @@
peer["down_speed"],
peer["up_speed"],
peer["country"],
- ip_int,
+ float(ip_int),
icon,
peer["progress"]])
Modified: trunk/deluge/ui/gtkui/peers_tab.py
===================================================================
--- trunk/deluge/ui/gtkui/peers_tab.py 2009-04-12 20:07:41 UTC (rev 5053)
+++ trunk/deluge/ui/gtkui/peers_tab.py 2009-04-13 18:02:49 UTC (rev 5054)
@@ -61,7 +61,7 @@
self.listview = glade.get_widget("peers_listview")
self.listview.connect("button-press-event",
self._on_button_press_event)
# country pixbuf, ip, client, downspeed, upspeed, country code,
int_ip, seed/peer icon, progress
- self.liststore = gtk.ListStore(gtk.gdk.Pixbuf, str, str, int, int,
str, gobject.TYPE_UINT, gtk.gdk.Pixbuf, float)
+ self.liststore = gtk.ListStore(gtk.gdk.Pixbuf, str, str, int, int,
str, float, gtk.gdk.Pixbuf, float)
self.cached_flag_pixbufs = {}
self.seed_pixbuf =
gtk.gdk.pixbuf_new_from_file(deluge.common.get_pixmap("seeding16.png"))
@@ -296,8 +296,17 @@
# Peer is not in list so we need to add it
# Create an int IP address for sorting purposes
- ip_int = sum([int(byte) << shift
- for byte, shift in
izip(peer["ip"].split(":")[0].split("."), (24, 16, 8, 0))])
+ if peer["ip"].count(":") == 1:
+ # This is an IPv4 address
+ ip_int = sum([int(byte) << shift
+ for byte, shift in
izip(peer["ip"].split(":")[0].split("."), (24, 16, 8, 0))])
+ else:
+ # This is an IPv6 address
+ import socket
+ import binascii
+ # Split out the :port
+ ip = ":".join(peer["ip"].split(":")[:-1])
+ ip_int =
long(binascii.hexlify(socket.inet_pton(socket.AF_INET6, ip)), 16)
if peer["seed"]:
icon = self.seed_pixbuf
@@ -311,7 +320,7 @@
peer["down_speed"],
peer["up_speed"],
peer["country"],
- ip_int,
+ float(ip_int),
icon,
peer["progress"]])
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---