ref/unref for net.Socket net.Server dgram.Socket
This commit is contained in:
parent
19d43f852e
commit
2637b5c261
11
lib/dgram.js
11
lib/dgram.js
@ -351,6 +351,17 @@ function onMessage(handle, slab, start, len, rinfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Socket.prototype.ref = function() {
|
||||||
|
if (this._handle)
|
||||||
|
this._handle.ref();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Socket.prototype.unref = function() {
|
||||||
|
if (this._handle)
|
||||||
|
this._handle.unref();
|
||||||
|
};
|
||||||
|
|
||||||
// TODO share with net_uv and others
|
// TODO share with net_uv and others
|
||||||
function errnoException(errorno, syscall) {
|
function errnoException(errorno, syscall) {
|
||||||
var e = new Error(syscall + ' ' + errorno);
|
var e = new Error(syscall + ' ' + errorno);
|
||||||
|
23
lib/net.js
23
lib/net.js
@ -716,6 +716,19 @@ Socket.prototype.connect = function(options, cb) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Socket.prototype.ref = function() {
|
||||||
|
if (this._handle)
|
||||||
|
this._handle.ref();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Socket.prototype.unref = function() {
|
||||||
|
if (this._handle)
|
||||||
|
this._handle.unref();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function afterConnect(status, handle, req, readable, writable) {
|
function afterConnect(status, handle, req, readable, writable) {
|
||||||
var self = handle.owner;
|
var self = handle.owner;
|
||||||
|
|
||||||
@ -1095,6 +1108,16 @@ Server.prototype._setupSlave = function(socketList) {
|
|||||||
this._slaves.push(socketList);
|
this._slaves.push(socketList);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Server.prototype.ref = function() {
|
||||||
|
if (this._handle)
|
||||||
|
this._handle.ref();
|
||||||
|
};
|
||||||
|
|
||||||
|
Server.prototype.unref = function() {
|
||||||
|
if (this._handle)
|
||||||
|
this._handle.unref();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// TODO: isIP should be moved to the DNS code. Putting it here now because
|
// TODO: isIP should be moved to the DNS code. Putting it here now because
|
||||||
// this is what the legacy system did.
|
// this is what the legacy system did.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user