call nativeConnect after defining the error handler/callback

This commit is contained in:
booo 2012-07-06 15:55:10 +02:00
parent 5329e5e17e
commit 17e8287bdd

View File

@ -30,7 +30,6 @@ p.connect = function(cb) {
if(err) {
return cb ? cb(err) : self.emit('error', err);
}
nativeConnect.call(self, conString);
if(cb) {
var errCallback;
var connectCallback = function() {
@ -46,6 +45,7 @@ p.connect = function(cb) {
self.once('connect', connectCallback);
self.once('error', errCallback);
}
nativeConnect.call(self, conString);
})
}