Skip to content

Commit b2d4d1e

Browse files
authored
COMPASS-147: SSH Tunnel Refactoring (#563)
* Prevent multiple connections in same window * Disconnect data-service on successful connection test Now that we’re in 1 window, this would create orphaned connections * COMPASS-147: Update mongodb-connection-model with ssh tunnel rewrite
1 parent 77e5c58 commit b2d4d1e

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
"moment": "^2.10.6",
125125
"mongodb": "^2.2.8",
126126
"mongodb-collection-model": "^0.3.0",
127-
"mongodb-connection-model": "^6.2.0",
127+
"mongodb-connection-model": "^6.3.0",
128128
"mongodb-data-service": "^2.0.0",
129129
"mongodb-database-model": "^0.1.2",
130130
"mongodb-explain-plan-model": "^0.2.1",

src/app/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,10 @@ app.extend({
335335
return this.preferences.isFeatureEnabled(feature);
336336
},
337337
setConnectionId: function(connectionId, done) {
338+
if (state.connection && state.connection.getId() === connectionId) {
339+
debug('Already connected to connectionId', connectionId);
340+
return done();
341+
}
338342
var StatusAction = app.appRegistry.getAction('Status.Actions');
339343
StatusAction.configure({
340344
visible: true,

src/app/models/connection.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,18 @@ module.exports = Connection.extend(storageMixin, {
7272
}
7373
},
7474
test: function(done) {
75+
var dataService = new DataService(this);
7576
var onTested = function(err) {
7677
if (err) {
7778
metrics.error(err);
7879
return done(err);
7980
}
8081

8182
debug('test worked!');
83+
dataService.disconnect();
8284
done(null, this);
8385
}.bind(this);
84-
var dataService = new DataService(this);
86+
8587
debug('Testing connection to `%j`...', this.serialize());
8688
dataService.connect(onTested);
8789
return this;

0 commit comments

Comments
 (0)