|
|
@ -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); |
|
|
|