Skip to content

test: deflake test-tls-js-stream

socket.destroy() can destory the stream before the chunk to write with socket.end() is actually sent. Furthermore socket.destroy() destroys p and not the actual raw socket. As a result it is possible that the connection is left open.

Remove socket.destroy() to ensure that the chunk is sent. Also use common.mustCall() to ensure that the 'secureConnection' and 'secureConnect' events are emitted exactly once.

Fixes: https://github.com/nodejs/node/issues/26938

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Merge request reports

Loading