Skip to content

Commit

Permalink
Fixes for authenication issue
Browse files Browse the repository at this point in the history
  • Loading branch information
christkv committed Dec 13, 2011
1 parent 1864768 commit 8249786
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/mongodb/connection/server.js
Expand Up @@ -237,7 +237,7 @@ Server.prototype.connect = function(dbInstance, options, callback) {
dbInstanceObject._removeHandler(chainedIds[i]);
}
// Trigger the callback for the error
callbackInstance.callback(null, mongoReply);
callbackInstance.callback(null, mongoReply, callbackInstance.info.connection);
} else {
// Check if we are the last callback
var chainedIds = callbackInfo.info.chained;
Expand All @@ -260,7 +260,7 @@ Server.prototype.connect = function(dbInstance, options, callback) {
// first result of the chain of methods
if(!foundChainedMethod) {
// Trigger the callback for the error
callbackInstance.callback(null, callbackInfo.info.results.shift());
callbackInstance.callback(null, callbackInfo.info.results.shift(), callbackInstance.info.connection);
}
}
} else if(typeof callbackInfo.callback === 'function') {
Expand All @@ -276,7 +276,7 @@ Server.prototype.connect = function(dbInstance, options, callback) {
}

// Trigger the callback
callbackInstance.callback(null, mongoReply);
callbackInstance.callback(null, mongoReply, callbackInstance.info.connection);
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions lib/mongodb/db.js
Expand Up @@ -363,6 +363,7 @@ Db.prototype.authenticate = function(username, password, callback) {
// Get the amount of connections in the pool to ensure we have authenticated all comments
var numberOfConnections = this.serverConfig.allRawConnections().length;
var errorObject = null;

// Execute all four
this._executeQueryCommand(DbCommand.createGetNonceCommand(self), {onAll:true}, function(err, result, connection) {
// Execute on all the connections
Expand Down Expand Up @@ -694,13 +695,13 @@ Db.prototype._registerHandler = function(db_command, raw, connection, callback)
// Add the callback to the list of handlers
this._mongodbHandlers._mongodbCallbacks[command.getRequestId().toString()] = callback;
// Add the information about the reply
this._mongodbHandlers._notReplied[command.getRequestId().toString()] = {start: new Date().getTime(), 'raw': raw, chained:chainedIds};
this._mongodbHandlers._notReplied[command.getRequestId().toString()] = {start: new Date().getTime(), 'raw': raw, chained:chainedIds, connection:connection};
}
} else {
// Add the callback to the list of handlers
this._mongodbHandlers._mongodbCallbacks[db_command.getRequestId().toString()] = callback;
// Add the information about the reply
this._mongodbHandlers._notReplied[db_command.getRequestId().toString()] = {start: new Date().getTime(), 'raw': raw};
this._mongodbHandlers._notReplied[db_command.getRequestId().toString()] = {start: new Date().getTime(), 'raw': raw, connection:connection};
}
}

Expand Down

0 comments on commit 8249786

Please sign in to comment.