From de1e7c27dfa7ff5c30f376bd3ff9d04f357313c1 Mon Sep 17 00:00:00 2001 From: DjLegolas Date: Mon, 18 Jun 2018 08:41:33 +0300 Subject: [PATCH] [#2867][WebUI] Fix Daemon connection problem Trying to connect to daemon B while still connected to A will cause the torrents from A to be shown after connecting to B. Therefor, checking if connected to any daemon before connecting to B. --- deluge/ui/web/js/deluge-all/ConnectionManager.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/deluge/ui/web/js/deluge-all/ConnectionManager.js b/deluge/ui/web/js/deluge-all/ConnectionManager.js index 075ef57b5..11e6ca8a5 100644 --- a/deluge/ui/web/js/deluge-all/ConnectionManager.js +++ b/deluge/ui/web/js/deluge-all/ConnectionManager.js @@ -229,15 +229,24 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { var selected = this.list.getSelectedRecords()[0]; if (!selected) return; - if (selected.get('status').toLowerCase() == 'connected') { + var me = this; + var disconnect = function() { deluge.client.web.disconnect({ success: function(result) { this.update(this); deluge.events.fire('disconnect'); }, - scope: this + scope: me }); - } else { + }; + + if (selected.get('status').toLowerCase() == 'connected') { + disconnect(); + } else { + if (this.list.getStore().find('status', 'Connected', 0, false, false) > -1) { + disconnect(); + } + var id = selected.id; deluge.client.web.connect(id, { success: function(methods) {