Author: andar

Revision: 5597

Log:
        Fix properly disconnecting from the currently connected daemon when 
connecting to a different daemon

Diff:
Modified: trunk/deluge/ui/gtkui/connectionmanager.py
===================================================================
--- trunk/deluge/ui/gtkui/connectionmanager.py  2009-07-31 00:18:35 UTC (rev 
5596)
+++ trunk/deluge/ui/gtkui/connectionmanager.py  2009-07-31 00:39:09 UTC (rev 
5597)
@@ -414,7 +414,14 @@
         user = model[row][HOSTLIST_COL_USER]
         password = model[row][HOSTLIST_COL_PASS]
 
-        client.connect(host, port, user, 
password).addCallback(self.__on_connected, host_id)
+        def do_connect(*args):
+            client.connect(host, port, user, 
password).addCallback(self.__on_connected, host_id)
+
+        if client.connected():
+            client.disconnect().addCallback(do_connect)
+        else:    
+            do_connect()
+            
         self.connection_manager.response(gtk.RESPONSE_OK)
 
     def on_button_close_clicked(self, widget):



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to