From 09ccdff13c7388449c8f3819fed6d54fffa5701f 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()`. --- lib/net.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/net.js b/lib/net.js index 41c1cacac5e6fd..3fe6c5a415eaf0 100644 --- a/lib/net.js +++ b/lib/net.js @@ -783,13 +783,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)