Skip to content

Commit

Permalink
Fixed Connection#close() without callback
Browse files Browse the repository at this point in the history
we need a noop dep
  • Loading branch information
tj committed Mar 30, 2011
1 parent f0372f8 commit 116b5dc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/mongoose/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ Connection.prototype.onOpen = function () {
*/

Connection.prototype.close = function (callback) {
var self = this;
var self = this
, callback = callback || function(){};

switch (this.readyState){
case 0: // disconnected
Expand All @@ -247,10 +248,10 @@ Connection.prototype.close = function (callback) {
this.readyState = 3;
this.doClose(function(err){
if (err){
if (callback) callback(err);
callback(err);
} else {
self.onClose();
if (callback) callback(null);
callback(null);
}
});
break;
Expand Down

0 comments on commit 116b5dc

Please sign in to comment.