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.h | |
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.h')
-rw-r--r-- | src/stream_base.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/stream_base.h b/src/stream_base.h index d5a759bd8d..4fe4a8c48c 100644 --- a/src/stream_base.h +++ b/src/stream_base.h @@ -247,6 +247,7 @@ class StreamResource { StreamListener* listener_ = nullptr; uint64_t bytes_read_ = 0; + uint64_t bytes_written_ = 0; friend class StreamListener; }; @@ -324,6 +325,9 @@ class StreamBase : public StreamResource { template <class Base> static void GetBytesRead(const v8::FunctionCallbackInfo<v8::Value>& args); + template <class Base> + static void GetBytesWritten(const v8::FunctionCallbackInfo<v8::Value>& args); + template <class Base, int (StreamBase::*Method)( const v8::FunctionCallbackInfo<v8::Value>& args)> |