From b8c423edca834d8787a5ccd4a7fb02be59118967 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 31 May 2018 05:35:49 -0600 Subject: [PATCH] leave the shackles behind --- index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index ce83bd0..25c1c8d 100644 --- a/index.js +++ b/index.js @@ -317,9 +317,21 @@ var sockFuncs = [ , 'setNoDelay' , '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. 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 var myDuplex = new require('stream').Duplex(); addressNames.forEach(function (name) { @@ -362,6 +374,7 @@ Packer.wrapSocket = function (socket) { }); return myDuplex; + */ }; var Transform = require('stream').Transform;