Fix adding peers
This commit is contained in:
parent
a36938729b
commit
da2499faa6
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue