diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-12-09 07:29:11 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-12-13 08:45:57 +0300 |
commit | 453008d73ef7248c809d4d1b52c127915b08fc46 (patch) | |
tree | ecccf51cbe93e3efbe48a42fde6ccb0fa495d9bf /src/js_stream.cc | |
parent | 24b0f67c2b0b97a4b79f9582e805785cb317daa0 (diff) |
src: minor refactoring to StreamBase writes
Instead of having per-request callbacks, always call a callback
on the `StreamBase` instance itself for `WriteWrap` and `ShutdownWrap`.
This makes `WriteWrap` cleanup consistent for all stream classes,
since the after-write callback is always the same now.
If special handling is needed for writes that happen to a sub-class,
`AfterWrite` can be overridden by that class, rather than that
class providing its own callback (e.g. updating the write
queue size for libuv streams).
If special handling is needed for writes that happen on another
stream instance, the existing `after_write_cb()` callback
is used for that (e.g. custom code after writing to the
transport from a TLS stream).
As a nice bonus, this also makes `WriteWrap` and `ShutdownWrap`
instances slightly smaller.
PR-URL: https://github.com/nodejs/node/pull/17564
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/js_stream.cc')
-rw-r--r-- | src/js_stream.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/js_stream.cc b/src/js_stream.cc index da719c357dd..22d267f5493 100644 --- a/src/js_stream.cc +++ b/src/js_stream.cc @@ -176,7 +176,7 @@ void JSStream::DoAfterWrite(const FunctionCallbackInfo<Value>& args) { ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); ASSIGN_OR_RETURN_UNWRAP(&w, args[0].As<Object>()); - wrap->OnAfterWrite(w); + w->Done(0); } |