diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-03-17 19:52:57 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-03-30 15:20:40 +0300 |
commit | 923fb5cc1861422291d135177770f94f473f4d6f (patch) | |
tree | 7900acd97fa0c6c8f42b56382afb1597f026f384 /src/stream_base.cc | |
parent | abc87862ff14c1571f008aa1a9cbf812bea9790c (diff) |
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 <jasnell@gmail.com>
Diffstat (limited to 'src/stream_base.cc')
-rw-r--r-- | src/stream_base.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/stream_base.cc b/src/stream_base.cc index 8838a1a6dfb..7b27a48c16f 100644 --- a/src/stream_base.cc +++ b/src/stream_base.cc @@ -243,6 +243,7 @@ int StreamBase::WriteString(const FunctionCallbackInfo<Value>& args) { uv_buf_t* bufs = &buf; size_t count = 1; err = DoTryWrite(&bufs, &count); + bytes_written_ += data_size; // Immediate failure or success if (err != 0 || count == 0) { |