diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-03-17 17:52:57 +0100 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-03-30 14:20:40 +0200 |
commit | 923fb5cc1861422291d135177770f94f473f4d6f (patch) | |
tree | 7900acd97fa0c6c8f42b56382afb1597f026f384 /src/stream_base.cc | |
parent | abc87862ff14c1571f008aa1a9cbf812bea9790c (diff) | |
download | android-node-v8-923fb5cc1861422291d135177770f94f473f4d6f.tar.gz android-node-v8-923fb5cc1861422291d135177770f94f473f4d6f.tar.bz2 android-node-v8-923fb5cc1861422291d135177770f94f473f4d6f.zip |
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 8838a1a6df..7b27a48c16 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) { |