mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-05 16:08:40 +00:00
Fix #1036 autoconnecting to localhost daemon on start-up
This commit is contained in:
parent
139d6538a2
commit
f6fdae727d
2 changed files with 34 additions and 4 deletions
|
@ -23,6 +23,7 @@
|
||||||
* Fix #692 no longer require tray password when quitting from the tray icon
|
* Fix #692 no longer require tray password when quitting from the tray icon
|
||||||
while the window is visible.
|
while the window is visible.
|
||||||
* Fix #782 do not ask for tray password when window is not minimized to tray
|
* Fix #782 do not ask for tray password when window is not minimized to tray
|
||||||
|
* Fix #1036 autoconnecting to localhost daemon on start-up
|
||||||
|
|
||||||
==== Console ====
|
==== Console ====
|
||||||
* Fix using the console in Windows, but only in command-line mode
|
* Fix using the console in Windows, but only in command-line mode
|
||||||
|
|
|
@ -173,6 +173,7 @@ class ConnectionManager(component.Component):
|
||||||
|
|
||||||
# Save the toggle options
|
# Save the toggle options
|
||||||
self.__save_options()
|
self.__save_options()
|
||||||
|
self.__save_hostlist()
|
||||||
|
|
||||||
self.connection_manager.destroy()
|
self.connection_manager.destroy()
|
||||||
del self.glade
|
del self.glade
|
||||||
|
@ -251,6 +252,10 @@ class ConnectionManager(component.Component):
|
||||||
|
|
||||||
def __update_list(self):
|
def __update_list(self):
|
||||||
"""Updates the host status"""
|
"""Updates the host status"""
|
||||||
|
if not hasattr(self, "liststore"):
|
||||||
|
# This callback was probably fired after the window closed
|
||||||
|
return
|
||||||
|
|
||||||
def on_connect(result, c, host_id):
|
def on_connect(result, c, host_id):
|
||||||
# Return if the deferred callback was done after the dialog was closed
|
# Return if the deferred callback was done after the dialog was closed
|
||||||
if not self.running:
|
if not self.running:
|
||||||
|
@ -414,6 +419,30 @@ class ConnectionManager(component.Component):
|
||||||
user = model[row][HOSTLIST_COL_USER]
|
user = model[row][HOSTLIST_COL_USER]
|
||||||
password = model[row][HOSTLIST_COL_PASS]
|
password = model[row][HOSTLIST_COL_PASS]
|
||||||
|
|
||||||
|
if status == _("Offline") and self.glade.get_widget("chk_autostart").get_active() and\
|
||||||
|
host in ("127.0.0.1", "localhost"):
|
||||||
|
# We need to start this localhost
|
||||||
|
client.start_daemon(port, deluge.configmanager.get_config_dir())
|
||||||
|
|
||||||
|
def on_connect_fail(result, try_counter):
|
||||||
|
log.error("Connection to host failed..")
|
||||||
|
# We failed connecting to the daemon, but lets try again
|
||||||
|
if try_counter:
|
||||||
|
log.info("Retrying connection.. Retries left: %s", try_counter)
|
||||||
|
try_counter -= 1
|
||||||
|
import time
|
||||||
|
time.sleep(0.5)
|
||||||
|
do_retry_connect(try_counter)
|
||||||
|
return result
|
||||||
|
def do_retry_connect(try_counter):
|
||||||
|
log.debug("user: %s pass: %s", user, password)
|
||||||
|
d = client.connect(host, port, user, password)
|
||||||
|
d.addCallback(self.__on_connected, host_id)
|
||||||
|
d.addErrback(on_connect_fail, try_counter)
|
||||||
|
|
||||||
|
do_retry_connect(6)
|
||||||
|
|
||||||
|
|
||||||
def do_connect(*args):
|
def do_connect(*args):
|
||||||
client.connect(host, port, user, password).addCallback(self.__on_connected, host_id)
|
client.connect(host, port, user, password).addCallback(self.__on_connected, host_id)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue