mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
Between onSocket and onSocketNT, the socket had no error handler, meaning any errors emitted during that window (e.g. from a blocklist check or custom lookup) would be unhandled even if the user had set up a request error handler. Fix this by attaching socketErrorListener synchronously in onSocket, setting socket._httpMessage so the listener can forward errors to the request. The _destroy path in onSocketNT is also guarded to prevent double-firing if socketErrorListener already emitted the error. Fixes: https://github.com/nodejs/node/issues/48771 Refs: https://github.com/nodejs/node/pull/61658 PR-URL: https://github.com/nodejs/node/pull/61770 Refs: https://github.com/nodejs/node/issues/48771 Reviewed-By: Tim Perry <pimterry@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>