mongodb-core
Advanced tools
Comparing version 2.1.15 to 2.1.16
@@ -0,1 +1,9 @@ | ||
2.1.16 2017-10-11 | ||
----------------- | ||
* avoid waiting for reconnect if reconnect disabled in Server topology | ||
* avoid waiting for reconnect if reconnect disabled in Cursor | ||
* NODE-990 cache the ScramSHA1 salted passwords up to 200 entries | ||
* NODE-1158 ensure that errors are propagated on force destroy | ||
* NODE-1158 ensure inUse and connecting queues are cleared on reauth | ||
2.1.15 2017-08-08 | ||
@@ -2,0 +10,0 @@ ----------------- |
@@ -77,15 +77,19 @@ "use strict"; | ||
// hiCache stores previous salt creations so it's not regenerated per-pool member | ||
var _hiCache = {}; | ||
var _hiCache = {}, _hiCacheCount = 0; | ||
var _hiCachePurge = function() { _hiCache = {}; _hiCacheCount = 0; } | ||
var hi = function(data, salt, iterations) { | ||
var key = [data, salt.toString("base64"), iterations].join("_"); | ||
// check if we've already generated this salt | ||
if (_hiCache[key] !== undefined) { return _hiCache[key] } | ||
// generate the salt and store it in the cache for the next worker | ||
var data = crypto.pbkdf2Sync(data, salt, iterations, 20, "sha1"); | ||
// omit the work if already generated | ||
var key = data + '_' + salt.toString('base64') + '_' + iterations; | ||
if (_hiCache[key] !== undefined) return _hiCache[key]; | ||
// generate the salt | ||
var saltedData = crypto.pbkdf2Sync(data, salt, iterations, 20, "sha1"); | ||
// cache a copy to speed up the next lookup, but prevent unbounded cache growth | ||
if (_hiCacheCount >= 200) _hiCachePurge(); | ||
_hiCache[key] = data; | ||
return data; | ||
_hiCacheCount += 1; | ||
return saltedData; | ||
} | ||
@@ -92,0 +96,0 @@ |
@@ -703,2 +703,4 @@ "use strict"; | ||
self.availableConnections = []; | ||
self.inUseConnections = []; | ||
self.connectingConnections = []; | ||
@@ -868,3 +870,3 @@ var connectionsCount = connections.length; | ||
if(typeof workItem.cb == 'function') { | ||
workItem.cb(null, err); | ||
workItem.cb(new MongoError('Pool was force destroyed')); | ||
} | ||
@@ -1305,2 +1307,3 @@ } | ||
if(writeSuccessful && workItem.immediateRelease && self.authenticating) { | ||
removeConnection(self, connection); | ||
self.nonAuthenticatedConnections.push(connection); | ||
@@ -1307,0 +1310,0 @@ } else if(writeSuccessful === false) { |
@@ -537,8 +537,15 @@ "use strict"; | ||
// Executed at some point when the handler deems it's reconnected | ||
if(!self.topology.isConnected(self.options) && self.disconnectHandler != null) { | ||
if (self.topology.isDestroyed()) { | ||
// Topology was destroyed, so don't try to wait for it to reconnect | ||
return callback(new MongoError('Topology was destroyed')); | ||
if(!self.topology.isConnected(self.options)) { | ||
if (!self.topology.s.options.reconnect) { | ||
// Reconnect is disabled, so we'll never reconnect | ||
return callback(new MongoError('no connection available')); | ||
} | ||
return self.disconnectHandler.addObjectAndMethod('cursor', self, 'next', [callback], callback); | ||
if (self.disconnectHandler != null) { | ||
if (self.topology.isDestroyed()) { | ||
// Topology was destroyed, so don't try to wait for it to reconnect | ||
return callback(new MongoError('Topology was destroyed')); | ||
} | ||
return self.disconnectHandler.addObjectAndMethod('cursor', self, 'next', [callback], callback); | ||
} | ||
} | ||
@@ -545,0 +552,0 @@ |
@@ -598,3 +598,3 @@ "use strict" | ||
/** | ||
* Recalculate all the stalness values for secodaries | ||
* Recalculate all the staleness values for secodaries | ||
* @method | ||
@@ -601,0 +601,0 @@ */ |
@@ -428,3 +428,3 @@ "use strict" | ||
// Calculate the stalness for this server | ||
// Calculate the staleness for this server | ||
self.s.replicaSetState.updateServerMaxStaleness(server, self.s.haInterval); | ||
@@ -431,0 +431,0 @@ |
@@ -191,3 +191,3 @@ "use strict" | ||
// Executed at some point when the handler deems it's reconnected | ||
if(!self.s.pool.isConnected() && self.s.disconnectHandler != null && !options.monitoring) { | ||
if(!self.s.pool.isConnected() && self.s.options.reconnect && self.s.disconnectHandler != null && !options.monitoring) { | ||
self.s.disconnectHandler.add(type, ns, cmd, options, callback); | ||
@@ -194,0 +194,0 @@ return true; |
{ | ||
"name": "mongodb-core", | ||
"version": "2.1.15", | ||
"version": "2.1.16", | ||
"description": "Core MongoDB driver functionality, no bells and whistles and meant for integration not end applications", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
446864
10543