Fix adding peers

This commit is contained in:
Andrew Resch 2008-10-18 04:10:34 +00:00
parent a36938729b
commit da2499faa6
3 changed files with 8 additions and 7 deletions

View File

@ -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)

View File

@ -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

View File

@ -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