diff --git a/lib/net_uv.js b/lib/net_uv.js index 8e000f68159..d45346e6f3e 100644 --- a/lib/net_uv.js +++ b/lib/net_uv.js @@ -440,15 +440,16 @@ Socket.prototype.connect = function(port /* [host], [cb] */) { function afterConnect(status, handle, req) { var self = handle.socket; - assert.equal(handle, self._handle); - - debug("afterConnect"); // callback may come after call to destroy if (self.destroyed) { return; } + assert.equal(handle, self._handle); + + debug("afterConnect"); + assert.ok(self._connecting); self._connecting = false;