leave the shackles behind
This commit is contained in:
parent
407e7c21c6
commit
b8c423edca
15
index.js
15
index.js
|
@ -317,9 +317,21 @@ var sockFuncs = [
|
||||||
, 'setNoDelay'
|
, 'setNoDelay'
|
||||||
, 'setTimeout'
|
, 'setTimeout'
|
||||||
];
|
];
|
||||||
// Improved workaround for https://github.com/nodejs/node/issues/8854
|
|
||||||
// Unlike Packer.Stream.create this should handle all of the events needed to make everything work.
|
// Unlike Packer.Stream.create this should handle all of the events needed to make everything work.
|
||||||
Packer.wrapSocket = function (socket) {
|
Packer.wrapSocket = function (socket) {
|
||||||
|
// node v10.2+ doesn't need a workaround for https://github.com/nodejs/node/issues/8854
|
||||||
|
addressNames.forEach(function (name) {
|
||||||
|
Object.defineProperty(socket, name, {
|
||||||
|
enumerable: false,
|
||||||
|
configurable: true,
|
||||||
|
get: function() {
|
||||||
|
return extractSocketProp(socket, name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return socket;
|
||||||
|
// Improved workaround for https://github.com/nodejs/node/issues/8854
|
||||||
|
/*
|
||||||
// TODO use defineProperty to override remotePort, etc
|
// TODO use defineProperty to override remotePort, etc
|
||||||
var myDuplex = new require('stream').Duplex();
|
var myDuplex = new require('stream').Duplex();
|
||||||
addressNames.forEach(function (name) {
|
addressNames.forEach(function (name) {
|
||||||
|
@ -362,6 +374,7 @@ Packer.wrapSocket = function (socket) {
|
||||||
});
|
});
|
||||||
|
|
||||||
return myDuplex;
|
return myDuplex;
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
var Transform = require('stream').Transform;
|
var Transform = require('stream').Transform;
|
||||||
|
|
Loading…
Reference in New Issue