From f66f793c07ed263938748593bec0eec204291e84 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 27 Apr 2012 04:42:10 +0200 Subject: [PATCH] net: hook up handle wrap to owning object --- lib/net.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/net.js b/lib/net.js index 49faf59db6..b03dcf5114 100644 --- a/lib/net.js +++ b/lib/net.js @@ -120,7 +120,7 @@ function initSocketHandle(self) { // Handle creation may be deferred to bind() or connect() time. if (self._handle) { - self._handle.socket = self; + self._handle.owner = self; self._handle.onread = onread; } } @@ -291,7 +291,7 @@ Socket.prototype.end = function(data, encoding) { function afterShutdown(status, handle, req) { - var self = handle.socket; + var self = handle.owner; assert.ok(self._flags & FLAG_SHUTDOWN); assert.ok(!self.writable); @@ -380,7 +380,7 @@ Socket.prototype.destroy = function(exception) { function onread(buffer, offset, length) { var handle = this; - var self = handle.socket; + var self = handle.owner; assert.equal(handle, self._handle); timers.active(self); @@ -583,7 +583,7 @@ Socket.prototype.__defineGetter__('bytesWritten', function() { function afterWrite(status, handle, req) { - var self = handle.socket; + var self = handle.owner; // callback may come after call to destroy. if (self.destroyed) { @@ -722,7 +722,7 @@ Socket.prototype.connect = function(options, cb) { function afterConnect(status, handle, req, readable, writable) { - var self = handle.socket; + var self = handle.owner; // callback may come after call to destroy if (self.destroyed) { @@ -881,7 +881,7 @@ Server.prototype._listen2 = function(address, port, addressType, backlog) { } self._handle.onconnection = onconnection; - self._handle.socket = self; + self._handle.owner = self; // Use a backlog of 512 entries. We pass 511 to the listen() call because // the kernel does: backlogsize = roundup_pow_of_two(backlogsize + 1); @@ -980,7 +980,7 @@ Server.prototype.address = function() { function onconnection(clientHandle) { var handle = this; - var self = handle.socket; + var self = handle.owner; debug('onconnection');