Permalink
Browse files

ensure readyState is set before emitting

  • Loading branch information...
aheckmann committed Jun 5, 2012
1 parent 15fc3ec commit f81f4cca75285102e9dfc99527c9f705185e5e55
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/connection.js
View
@@ -179,11 +179,11 @@ Connection.prototype.open = function (host, database, port, options, callback) {
// open connection
this.doOpen(function (err) {
if (err) {
+ self.readyState = 0;
if (self._events && self._events.error &&
('function' == typeof self._events.error || self._events.error.length)) {
self.emit("error", err);
}
- self.readyState = 0;
} else {
self.onOpen();
}

0 comments on commit f81f4cc

Please sign in to comment.