From 8d8097488cd71991063a11d8ac605318cc5ff38c Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Mon, 29 Jan 2018 10:23:02 +0100 Subject: [PATCH] net: remove redundant code from _writeGeneric() The encoding is already handled by `Writable.prototype.write()`. PR-URL: https://github.com/nodejs/node/pull/18429 Reviewed-By: Matteo Collina Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Ruben Bridgewater --- lib/net.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/net.js b/lib/net.js index 540f7ce800d520..54c161c382a306 100644 --- a/lib/net.js +++ b/lib/net.js @@ -758,13 +758,7 @@ Socket.prototype._writeGeneric = function(writev, data, encoding, cb) { // Retain chunks if (err === 0) req._chunks = chunks; } else { - var enc; - if (data instanceof Buffer) { - enc = 'buffer'; - } else { - enc = encoding; - } - err = createWriteReq(req, this._handle, data, enc); + err = createWriteReq(req, this._handle, data, encoding); } if (err)