summaryrefslogtreecommitdiff
path: root/src/stream_base.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-02-13 01:23:50 +0100
committerAnna Henningsen <anna@addaleax.net>2018-03-15 12:53:13 +0100
commit67f1d76956a8a5da9875b113371c8786ad579086 (patch)
tree220df0ab56ebc499c1edec20fe7b90449189d44b /src/stream_base.h
parentf7f1437d44f3e4b745e36540a752065cc58d993b (diff)
downloadnode-new-67f1d76956a8a5da9875b113371c8786ad579086.tar.gz
src: introduce native-layer stream piping
Provide a way to create pipes between native `StreamBase` instances that acts more directly than a `.pipe()` call would. PR-URL: https://github.com/nodejs/node/pull/18936 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'src/stream_base.h')
-rw-r--r--src/stream_base.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/stream_base.h b/src/stream_base.h
index 96a7787e5b..7264824265 100644
--- a/src/stream_base.h
+++ b/src/stream_base.h
@@ -141,6 +141,9 @@ class StreamListener {
// This is called immediately before the stream is destroyed.
virtual void OnStreamDestroy() {}
+ // The stream this is currently associated with, or nullptr if there is none.
+ inline StreamResource* stream() { return stream_; }
+
protected:
// Pass along a read error to the `StreamListener` instance that was active
// before this one. For example, a protocol parser does not care about read