Skip to content

tls: use .destroy(err) instead of destroy+emit - #1711

Closed
indutny wants to merge 1 commit into
nodejs:masterfrom
indutny:fix/tls-close-error-event
Closed

tls: use .destroy(err) instead of destroy+emit#1711
indutny wants to merge 1 commit into
nodejs:masterfrom
indutny:fix/tls-close-error-event

Conversation

@indutny

Copy link
Copy Markdown
Member

Emit errors using .destroy(err) instead of .destroy() and
.emit('error', err). Otherwise close event is emitted with the
error argument set to false, even if the connection was torn down
because of the error.

See: #1119

Emit errors using `.destroy(err)` instead of `.destroy()` and
`.emit('error', err)`. Otherwise `close` event is emitted with the
`error` argument set to `false`, even if the connection was torn down
because of the error.
See: nodejs#1119
@Fishrock123Fishrock123 added the tls Issues and PRs related to the tls subsystem. label May 15, 2015
@chrisdickinson

Copy link
Copy Markdown
Contributor

LGTM.

indutny added a commit that referenced this pull request May 22, 2015
Emit errors using `.destroy(err)` instead of `.destroy()` and
`.emit('error', err)`. Otherwise `close` event is emitted with the
`error` argument set to `false`, even if the connection was torn down
because of the error.
See: #1119
PR-URL: #1711
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
@indutny

Copy link
Copy Markdown
MemberAuthor

Landed in 80342f6, thank you!

@indutnyindutny closed this May 22, 2015
@indutny
indutny deleted the fix/tls-close-error-event branch May 22, 2015 11:28
indutny pushed a commit that referenced this pull request May 22, 2015
This fixes a race condition introduced in 80342f6.
`socket.destroy(err)` only emits the passed error when
`socket._writableState.errorEmitted === false`, `ssl.onerror`
sets `errorEmitted = true` just before calling
`socket.destroy()`.
See: #1119
See: #1711
PR-URL: #1769
Reviewed-By: Fedor Indutny <fedor@indutny.com>
@rvaggrvagg mentioned this pull request May 23, 2015
andrewdeandrade pushed a commit to andrewdeandrade/node that referenced this pull request Jun 3, 2015
Emit errors using `.destroy(err)` instead of `.destroy()` and
`.emit('error', err)`. Otherwise `close` event is emitted with the
`error` argument set to `false`, even if the connection was torn down
because of the error.
See: nodejs/node#1119
PR-URL: nodejs/node#1711
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
andrewdeandrade pushed a commit to andrewdeandrade/node that referenced this pull request Jun 3, 2015
This fixes a race condition introduced in 80342f6.
`socket.destroy(err)` only emits the passed error when
`socket._writableState.errorEmitted === false`, `ssl.onerror`
sets `errorEmitted = true` just before calling
`socket.destroy()`.
See: nodejs/node#1119
See: nodejs/node#1711
PR-URL: nodejs/node#1769
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tlsIssues and PRs related to the tls subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@indutny@chrisdickinson@Fishrock123