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:
parent
dceebbfa31
commit
d2eaabd0df
@ -91,7 +91,7 @@ function Socket(type, listener) {
|
|||||||
events.EventEmitter.call(this);
|
events.EventEmitter.call(this);
|
||||||
|
|
||||||
var handle = newHandle(type);
|
var handle = newHandle(type);
|
||||||
handle.socket = this;
|
handle.owner = this;
|
||||||
|
|
||||||
this._handle = handle;
|
this._handle = handle;
|
||||||
this._receiving = false;
|
this._receiving = false;
|
||||||
@ -200,7 +200,7 @@ Socket.prototype.send = function(buffer,
|
|||||||
|
|
||||||
|
|
||||||
function afterSend(status, handle, req, 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?
|
// CHECKME socket's been closed by user, don't call callback?
|
||||||
if (handle !== self._handle)
|
if (handle !== self._handle)
|
||||||
@ -344,7 +344,7 @@ Socket.prototype._stopReceiving = function() {
|
|||||||
|
|
||||||
|
|
||||||
function onMessage(handle, slab, start, len, rinfo) {
|
function onMessage(handle, slab, start, len, rinfo) {
|
||||||
var self = handle.socket;
|
var self = handle.owner;
|
||||||
if (!slab) return self.emit('error', errnoException(errno, 'recvmsg'));
|
if (!slab) return self.emit('error', errnoException(errno, 'recvmsg'));
|
||||||
rinfo.size = len; // compatibility
|
rinfo.size = len; // compatibility
|
||||||
self.emit('message', slab.slice(start, start + len), rinfo);
|
self.emit('message', slab.slice(start, start + len), rinfo);
|
||||||
|
Loading…
Reference in New Issue
Block a user