Skip to content

http: allow passing callbacks for [Incoming,Outgoing]Message#destroy#33907

Closed
rexagod wants to merge 1 commit into
nodejs:masterfrom
rexagod:i-28236
Closed

http: allow passing callbacks for [Incoming,Outgoing]Message#destroy#33907
rexagod wants to merge 1 commit into
nodejs:masterfrom
rexagod:i-28236

Conversation

@rexagod

@rexagod rexagod commented Jun 16, 2020

Copy link
Copy Markdown
Member

Fixes: #28236

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the http Issues or PRs related to the http subsystem. label Jun 16, 2020
@lpinca

lpinca commented Jun 16, 2020

Copy link
Copy Markdown
Member

I think we wanted to remove the callback from public destroy(), only the _destroy() implementation should take a callback.

cc: @nodejs/streams @ronag

@lpinca lpinca added the stream Issues and PRs related to the stream subsystem. label Jun 16, 2020
@ronag

ronag commented Jun 16, 2020

Copy link
Copy Markdown
Member

I think we wanted to remove the callback from public destroy(), only the _destroy() implementation should take a callback.

Yup. This is an undocumented API we would like to remove.

You should do the following instead:

x.destroy(er)
finished(er, cb)

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ronag

ronag commented Jun 16, 2020

Copy link
Copy Markdown
Member

If we can backport this to 12 it would be good. It would fix #28236 which is already fixed on 14+ but that was through a semver-major change.

@lpinca lpinca left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We moved away from using the internal only, undocumented destroy(err, cb) api. This moves in the opposite direction and makes the api public.

@ronag

ronag commented Jun 16, 2020

Copy link
Copy Markdown
Member

We moved away from using the internal only, undocumented destroy(err, cb) api. This moves in the opposite direction and make the api public.

I agree, but it does fix a bug in v12 which would otherwise require a semver major change.

EDIT: I guess that could be fixed in a non semver-major way that does not require this PR... if a bit hackish.

@lpinca

lpinca commented Jun 16, 2020

Copy link
Copy Markdown
Member

I would rather keep the bug than exposing an internal only, soon to be removed, api as public.

@rexagod rexagod requested a review from a team as a code owner August 10, 2020 16:06
@aduh95 aduh95 added the stalled Issues and PRs that are stalled. label Oct 16, 2020
@github-actions

Copy link
Copy Markdown
Contributor

This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open.

@github-actions

Copy link
Copy Markdown
Contributor

Closing this because it has stalled. Feel free to reopen if this PR is still relevant, or to ping the collaborator who labelled it stalled if you have any questions.

@github-actions github-actions Bot closed this Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

http Issues or PRs related to the http subsystem. stalled Issues and PRs that are stalled. stream Issues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IncomingMessage and OutgoingMessage's destroy ignores the second argument callback, swallowing the error

6 participants