call nativeConnect after defining the error handler/callback
This commit is contained in:
parent
5329e5e17e
commit
17e8287bdd
@ -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);
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user