Browse Source

dgram: hook up handle wrap to owning object

v0.9.1-release
Ben Noordhuis 13 years ago
parent
commit
d2eaabd0df
  1. 6
      lib/dgram.js

6
lib/dgram.js

@ -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…
Cancel
Save