From da2499faa6d1f51fde4c3b0b8a6d8498c292a815 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sat, 18 Oct 2008 04:10:34 +0000 Subject: [PATCH] Fix adding peers --- deluge/core/core.py | 6 +++--- deluge/core/torrent.py | 7 ++++--- deluge/ui/gtkui/common.py | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/deluge/core/core.py b/deluge/core/core.py index 7bd709094..55f6d6fa0 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -450,10 +450,10 @@ class Core( if not self.torrents[torrent_id].pause(): log.warning("Error pausing torrent %s", torrent_id) - def export_connect_peer(self, torrent_id, ip): + def export_connect_peer(self, torrent_id, ip, port): log.debug("adding peer %s to %s", ip, torrent_id) - if not self.torrents[torrent_id].connect_peer(ip): - log.warning("Error adding peer %s to %s", ip, torrent_id) + if not self.torrents[torrent_id].connect_peer(ip, port): + log.warning("Error adding peer %s:%s to %s", ip, port, torrent_id) def export_move_storage(self, torrent_ids, dest): log.debug("Moving storage %s to %s", torrent_ids, dest) diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index 18b48b50c..788cec978 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -698,11 +698,12 @@ class Torrent: return True - def connect_peer(self, ip): + def connect_peer(self, ip, port): """adds manual peer""" try: - self.handle.connect_peer(ip) - except: + self.handle.connect_peer((ip, int(port)), 0) + except Exception, e: + log.debug("Unable to connect to peer: %s", e) return False return True diff --git a/deluge/ui/gtkui/common.py b/deluge/ui/gtkui/common.py index b7b454813..630ddc5a4 100644 --- a/deluge/ui/gtkui/common.py +++ b/deluge/ui/gtkui/common.py @@ -159,6 +159,6 @@ def add_peer_dialog(): if deluge.common.is_ip(ip): id = component.get("TorrentView").get_selected_torrent() log.debug("adding peer %s to %s", value, id) - client.connect_peer(id, value) + client.connect_peer(id, ip, port) peer_dialog.destroy() return True