diff --git a/index.js b/index.js index 2f3b8d6..80b72a6 100644 --- a/index.js +++ b/index.js @@ -95,7 +95,7 @@ function duplicator(cb) { console.error(ERR_MSG.FWD_CONN_ERROR, err) client.end() } - buffer.end() + if (client.connected && !buffer.ended) buffer.end() return } if (forwardResponse) connection.pipe(client)