summaryrefslogtreecommitdiff
path: root/src/stream_base.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2017-11-03 20:13:18 +0100
committerJames M Snell <jasnell@gmail.com>2017-11-03 14:46:28 -0700
commita5f3b3a6dab18e32ee5e7d0d79a63cec0d5d5cc5 (patch)
treebe72fa320672dca39459a2fb957e973a6fc06f0b /src/stream_base.h
parent5d0436fbeafeb0498d82430d38650b65a5c4220d (diff)
downloadnode-new-a5f3b3a6dab18e32ee5e7d0d79a63cec0d5d5cc5.tar.gz
src: add method to compute storage in WriteWrap
`WriteWrap` instances may contain extra storage space. `self_size()` returns the size of the *entire* struct, member fields as well as storage space, so it is not an accurate measure for the storage space available. Add a method `ExtraSize()` (like the existing `Extra()` for accessing the storage memory) that yields the wanted value, and use it in the HTTP2 impl to fix a crash. PR-URL: https://github.com/nodejs/node/pull/16727 Refs: https://github.com/nodejs/node/pull/16669 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/stream_base.h')
-rw-r--r--src/stream_base.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/stream_base.h b/src/stream_base.h
index 9833a82636..20cb0155c9 100644
--- a/src/stream_base.h
+++ b/src/stream_base.h
@@ -77,6 +77,7 @@ class WriteWrap: public ReqWrap<uv_write_t>,
size_t extra = 0);
inline void Dispose();
inline char* Extra(size_t offset = 0);
+ inline size_t ExtraSize() const;
inline StreamBase* wrap() const { return wrap_; }