From 18115a7de7e90f6e66efa96d49cc498a319e093e Mon Sep 17 00:00:00 2001 From: Lucas Hrabovsky Date: Tue, 1 Nov 2016 16:06:53 -0400 Subject: [PATCH 1/3] Prevent multiple connections in same window --- src/app/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/index.js b/src/app/index.js index cf4b2e2a992..f24b297f5e6 100644 --- a/src/app/index.js +++ b/src/app/index.js @@ -335,6 +335,10 @@ app.extend({ return this.preferences.isFeatureEnabled(feature); }, setConnectionId: function(connectionId, done) { + if (state.connection && state.connection.getId() === connectionId) { + debug('Already connected to connectionId', connectionId); + return done(); + } var StatusAction = app.appRegistry.getAction('Status.Actions'); StatusAction.configure({ visible: true, From ab208d600a97ce0d2abfe83648cba3103e24ac10 Mon Sep 17 00:00:00 2001 From: Lucas Hrabovsky Date: Tue, 1 Nov 2016 16:07:45 -0400 Subject: [PATCH 2/3] Disconnect data-service on successful connection test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that we’re in 1 window, this would create orphaned connections --- src/app/models/connection.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/models/connection.js b/src/app/models/connection.js index 92bb82b7480..6bd9eb3430f 100644 --- a/src/app/models/connection.js +++ b/src/app/models/connection.js @@ -72,6 +72,7 @@ module.exports = Connection.extend(storageMixin, { } }, test: function(done) { + var dataService = new DataService(this); var onTested = function(err) { if (err) { metrics.error(err); @@ -79,9 +80,10 @@ module.exports = Connection.extend(storageMixin, { } debug('test worked!'); + dataService.disconnect(); done(null, this); }.bind(this); - var dataService = new DataService(this); + debug('Testing connection to `%j`...', this.serialize()); dataService.connect(onTested); return this; From 5f8f93a6f3d2a35ed4046d82565b5dec3d3a1580 Mon Sep 17 00:00:00 2001 From: Lucas Hrabovsky Date: Tue, 1 Nov 2016 16:08:18 -0400 Subject: [PATCH 3/3] COMPASS-147: Update mongodb-connection-model with ssh tunnel rewrite --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c48116f902c..41fd257be06 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "moment": "^2.10.6", "mongodb": "^2.2.8", "mongodb-collection-model": "^0.3.0", - "mongodb-connection-model": "^6.2.0", + "mongodb-connection-model": "^6.3.0", "mongodb-data-service": "^2.0.0", "mongodb-database-model": "^0.1.2", "mongodb-explain-plan-model": "^0.2.1",