Fix endless loop when trying to autoconnect to an offline daemon

This commit is contained in:
Andrew Resch 2009-11-13 05:26:54 +00:00
commit b10ea808fd
2 changed files with 4 additions and 6 deletions

View file

@ -9,6 +9,7 @@
* 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 * Fix autoconnecting to the next host in the list if the selected one isn't available
* Fix endless loop when trying to autoconnect to an offline daemon
==== Web ==== ==== Web ====
* Fix installing the deluge-web manpage * Fix installing the deluge-web manpage

View file

@ -310,9 +310,6 @@ Please see the details below for more information."), details=traceback.format_e
_("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
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):
@ -323,14 +320,14 @@ Please see the details below for more information."), details=traceback.format_e
try_counter -= 1 try_counter -= 1
import time import time
time.sleep(0.5) time.sleep(0.5)
do_connect() do_connect(try_counter)
return result return result
def do_connect(): def do_connect(try_counter):
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(6)
break break
if self.config["show_connection_manager_on_start"]: if self.config["show_connection_manager_on_start"]: