From 8fa2ddc055d81331c922e22f4975ea0c151a8771 Mon Sep 17 00:00:00 2001 From: isul Date: Fri, 8 Feb 2019 15:20:58 +0900 Subject: [PATCH 1/2] Fixed the following error when duplicate server is down. "BufferedStream is already ended" --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 2f3b8d6..2826a2f 100644 --- a/index.js +++ b/index.js @@ -95,7 +95,8 @@ 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) From cedd176241fa75528097b5bc89411e842f77b687 Mon Sep 17 00:00:00 2001 From: isul Date: Fri, 8 Feb 2019 15:38:25 +0900 Subject: [PATCH 2/2] changed coding style --- index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.js b/index.js index 2826a2f..80b72a6 100644 --- a/index.js +++ b/index.js @@ -95,8 +95,7 @@ function duplicator(cb) { console.error(ERR_MSG.FWD_CONN_ERROR, err) client.end() } - if (client.connected && !buffer.ended) - buffer.end() + if (client.connected && !buffer.ended) buffer.end() return } if (forwardResponse) connection.pipe(client)