Unverified Commit 453008d7 authored by Anna Henningsen's avatar Anna Henningsen
Browse files

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: default avatarAnatoli Papirovski <apapirovski@mac.com>
Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
parent 24b0f67c
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment