From 923fb5cc1861422291d135177770f94f473f4d6f Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 17 Mar 2018 17:52:57 +0100 Subject: net: track bytesWritten in C++ land Move tracking of `socket.bytesWritten` to C++ land. This makes it easier to provide this functionality for all `StreamBase` instances, and in particular should keep working when they have been 'consumed' in C++ in some way (e.g. for the network sockets that are underlying to TLS or HTTP2 streams). Also, this parallels `socket.bytesRead` a lot more now. PR-URL: https://github.com/nodejs/node/pull/19551 Reviewed-By: James M Snell --- lib/internal/net.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/internal/net.js') diff --git a/lib/internal/net.js b/lib/internal/net.js index 9c2602b79e..78e155e055 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); -- cgit v1.2.3