From 0c5dea867d08324b4d431e10f88550a878d10d13 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 24 Mar 2018 19:23:51 +0100 Subject: [PATCH] =?UTF-8?q?[squash]=20fix=20windows=20=F0=9F=A4=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/internal/net.js | 2 +- lib/net.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/internal/net.js b/lib/internal/net.js index 9c2602b79e9208..78e155e055a820 100644 --- a/lib/internal/net.js +++ b/lib/internal/net.js @@ -32,7 +32,7 @@ function makeSyncWrite(fd) { if (enc !== 'buffer') chunk = Buffer.from(chunk, enc); - this._bytesDispatched += chunk.length; + this._handle.bytesWritten += chunk.length; const ctx = {}; writeBuffer(fd, chunk, 0, chunk.length, null, undefined, ctx); diff --git a/lib/net.js b/lib/net.js index 96ce990d8c7df8..5b460befa49374 100644 --- a/lib/net.js +++ b/lib/net.js @@ -278,6 +278,11 @@ function Socket(options) { this._writev = null; this._write = makeSyncWrite(fd); + // makeSyncWrite adjusts this value like the original handle would, so + // we need to let it do that by turning it into a writable, own property. + Object.defineProperty(this._handle, 'bytesWritten', { + value: 0, writable: true + }); } } else { // these will be set once there is a connection