From f734b3eb04c0d355ef7ab893ed5869b867d35642 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 22 Feb 2018 14:37:58 +0100 Subject: src: give StreamBases the capability to ask for data Add a `OnStreamWantsWrite()` event that allows streams to ask for more input data if they want some. PR-URL: https://github.com/nodejs/node/pull/18936 Reviewed-By: James M Snell Reviewed-By: Matteo Collina --- src/stream_base-inl.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/stream_base-inl.h') diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h index b7495a80ac..f0d522a7b0 100644 --- a/src/stream_base-inl.h +++ b/src/stream_base-inl.h @@ -136,6 +136,13 @@ inline void StreamResource::EmitAfterShutdown(ShutdownWrap* w, int status) { listener_->OnStreamAfterShutdown(w, status); } +inline void StreamResource::EmitWantsWrite(size_t suggested_size) { +#ifdef DEBUG + v8::SealHandleScope handle_scope(v8::Isolate::GetCurrent()); +#endif + listener_->OnStreamWantsWrite(suggested_size); +} + inline StreamBase::StreamBase(Environment* env) : env_(env) { PushStreamListener(&default_listener_); } -- cgit v1.2.3