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

This commit is contained in:
Andrew Resch 2009-07-31 00:39:09 +00:00
parent 2089fd1823
commit ee442536a8
1 changed files with 8 additions and 1 deletions

View File

@ -414,7 +414,14 @@ class ConnectionManager(component.Component):
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):