diff --git a/lib/dispatcher/client-h1.js b/lib/dispatcher/client-h1.js index 5018108d636..37fe94e2c4f 100644 --- a/lib/dispatcher/client-h1.js +++ b/lib/dispatcher/client-h1.js @@ -769,8 +769,19 @@ async function connectH1 (client, socket) { client[kSocket] = socket if (!llhttpInstance) { + const noop = () => {} + socket.on('error', noop) llhttpInstance = await llhttpPromise llhttpPromise = null + socket.off('error', noop) + } + + if (socket.errored) { + throw socket.errored + } + + if (socket.destroyed) { + throw new SocketError('destroyed') } socket[kNoRef] = false