Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tls: fix bugs of double TLS
Remove unnecessary saving of `this` for arrow function.
  • Loading branch information
ywave620 committed Jul 17, 2023
commit 8ce31c603ef7bb68ed3c12d99e84bdfeaa7bb07e
5 changes: 2 additions & 3 deletions lib/_tls_wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -597,15 +597,14 @@ function TLSSocket(socket, opts) {
// `wrap` is a streams.Writable in JS. This empty write will be queued
// and hence finish after all existing writes, which is the timing
// we want to start to send any tls data to `wrap`.
const that = this;
wrap.write('', (err) => {
if (err) {
debug('error got before writing any tls data to the underlying stream');
that.destroy(err);
this.destroy(err);
return;
}

that._handle.writesIssuedByPrevListenerDone();
this._handle.writesIssuedByPrevListenerDone();
});
}

Expand Down