From 17e8287bdd1967eeab5ca28d797ce3f994a2b32b Mon Sep 17 00:00:00 2001 From: booo Date: Fri, 6 Jul 2012 15:55:10 +0200 Subject: [PATCH] call nativeConnect after defining the error handler/callback --- lib/native/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/native/index.js b/lib/native/index.js index 423bbd3..bf2aa0f 100644 --- a/lib/native/index.js +++ b/lib/native/index.js @@ -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); }) }