Skip to content

Commit

Permalink
ensure readyState is set before emitting
Browse files Browse the repository at this point in the history
  • Loading branch information
aheckmann committed Jun 5, 2012
1 parent 15fc3ec commit f81f4cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/connection.js
Expand Up @@ -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();
}
Expand Down

0 comments on commit f81f4cc

Please sign in to comment.