summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Nagy <ronagy@icloud.com>2020-04-13 11:12:13 +0200
committerRobert Nagy <ronagy@icloud.com>2020-04-16 09:26:50 +0200
commit15cc2b652b3199e8bf625c641a72b4233e176ac3 (patch)
tree5a4b00f0938bc1fe55005b269b672eaa0f653cbc
parentb61488fe24ba0df85d0fc76703d769ed68e6920c (diff)
downloadnode-new-15cc2b652b3199e8bf625c641a72b4233e176ac3.tar.gz
stream: update comment to indicate unused API
destroy w/ callback was previously used by node core. This is no longer the case and the comments should reflect this to avoid confusion. PR-URL: https://github.com/nodejs/node/pull/32808 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
-rw-r--r--lib/internal/streams/destroy.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/internal/streams/destroy.js b/lib/internal/streams/destroy.js
index 6eb46c7f7c..207074a0c2 100644
--- a/lib/internal/streams/destroy.js
+++ b/lib/internal/streams/destroy.js
@@ -1,15 +1,13 @@
'use strict';
-// Undocumented cb() API, needed for core, not for public API.
-// The cb() will be invoked synchronously if _destroy is synchronous.
-// If cb is passed no 'error' event will be emitted.
+// Backwards compat. cb() is undocumented and unused in core but
+// unfortunately might be used by modules.
function destroy(err, cb) {
const r = this._readableState;
const w = this._writableState;
if ((w && w.destroyed) || (r && r.destroyed)) {
if (typeof cb === 'function') {
- // TODO(ronag): Invoke with `'close'`/`'error'`.
cb();
}