Skip to content

Commit ee53983

Browse files
committed
fix(mongos): disconnect proxies which are not mongos instances
NODE-2232
1 parent 37dbe49 commit ee53983

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/core/topologies/mongos.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,8 @@ function handleInitialConnectEvent(self, event) {
366366
self.s.logger.warn(f(message, _this.name));
367367
}
368368

369-
// This is not a mongos proxy, remove it completely
369+
// This is not a mongos proxy, destroy and remove it completely
370+
_this.destroy(true);
370371
removeProxyFrom(self.connectingProxies, _this);
371372
// Emit the left event
372373
self.emit('left', 'server', _this);
@@ -445,10 +446,9 @@ function connectProxies(self, servers) {
445446
server.connect(self.s.connectOptions);
446447
}, timeoutInterval);
447448
}
449+
448450
// Start all the servers
449-
while (servers.length > 0) {
450-
connect(servers.shift(), timeoutInterval++);
451-
}
451+
servers.forEach(server => connect(server, timeoutInterval++));
452452
}
453453

454454
function pickProxy(self, session) {

0 commit comments

Comments
 (0)