0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 23:16:30 +01:00

dgram: hook up handle wrap to owning object

This commit is contained in:
Ben Noordhuis 2012-04-27 04:37:27 +02:00
parent dceebbfa31
commit d2eaabd0df

View File

@ -91,7 +91,7 @@ function Socket(type, listener) {
events.EventEmitter.call(this);
var handle = newHandle(type);
handle.socket = this;
handle.owner = this;
this._handle = handle;
this._receiving = false;
@ -200,7 +200,7 @@ Socket.prototype.send = function(buffer,
function afterSend(status, handle, req, buffer) {
var self = handle.socket;
var self = handle.owner;
// CHECKME socket's been closed by user, don't call callback?
if (handle !== self._handle)
@ -344,7 +344,7 @@ Socket.prototype._stopReceiving = function() {
function onMessage(handle, slab, start, len, rinfo) {
var self = handle.socket;
var self = handle.owner;
if (!slab) return self.emit('error', errnoException(errno, 'recvmsg'));
rinfo.size = len; // compatibility
self.emit('message', slab.slice(start, start + len), rinfo);