Fix autoconnecting to the next host in the list if the selected one isn't available

This commit is contained in:
Andrew Resch 2009-11-13 05:22:38 +00:00
commit 234863b664
2 changed files with 6 additions and 4 deletions

View file

@ -8,6 +8,7 @@
* Fix disabling/enabling plugins after switching daemons * Fix disabling/enabling plugins after switching daemons
* Reduce height of Add Torrent Dialog by ~80 pixels * Reduce height of Add Torrent Dialog by ~80 pixels
* Fix #1071 issue where Deluge will fail to start if there is a stale ipc lockfile * Fix #1071 issue where Deluge will fail to start if there is a stale ipc lockfile
* Fix autoconnecting to the next host in the list if the selected one isn't available
==== Web ==== ==== Web ====
* Fix installing the deluge-web manpage * Fix installing the deluge-web manpage

View file

@ -309,10 +309,10 @@ Please see the details below for more information."), details=traceback.format_e
dialogs.ErrorDialog( dialogs.ErrorDialog(
_("Error Starting Daemon"), _("Error Starting Daemon"),
_("There was an error starting the daemon process. Try running it from a console to see if there is an error.")).run() _("There was an error starting the daemon process. Try running it from a console to see if there is an error.")).run()
# We'll try 30 reconnects at 500ms intervals # We'll try 30 reconnects at 500ms intervals
try_counter = 30 try_counter = 30
def on_connect(connector): def on_connect(connector):
component.start() component.start()
def on_connect_fail(result, try_counter): def on_connect_fail(result, try_counter):
@ -325,12 +325,13 @@ Please see the details below for more information."), details=traceback.format_e
time.sleep(0.5) time.sleep(0.5)
do_connect() do_connect()
return result return result
def do_connect(): def do_connect():
client.connect(*host[1:]).addCallback(on_connect).addErrback(on_connect_fail, try_counter) client.connect(*host[1:]).addCallback(on_connect).addErrback(on_connect_fail, try_counter)
if try_connect: if try_connect:
do_connect() do_connect()
break
if self.config["show_connection_manager_on_start"]: if self.config["show_connection_manager_on_start"]:
# XXX: We need to call a simulate() here, but this could be a bug in twisted # XXX: We need to call a simulate() here, but this could be a bug in twisted