From a24f88e8d0442f8f485f7b78cbf0be55c46beba9 Mon Sep 17 00:00:00 2001 From: "kentaro.mori" Date: Thu, 8 Mar 2018 22:19:03 +0900 Subject: [PATCH 1/4] Fixed bug at the close method of Server. --- lib/Server.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/Server.js b/lib/Server.js index f8d0ac4..71df0f1 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -137,11 +137,7 @@ class Server extends EventEmitter { this.clientOptions.log.stdLog('Closing all connections and exiting...'); } - this.webSocketServer.close(() => { - this.activeConnections.forEach((activeConnection) => { - activeConnection.close(); - }); - }); + this.webSocketServer._server.close(); } newConnection(webSocketConnection) { From 699be0b077a8ce789a4db9bf5fe009ccba91b5e0 Mon Sep 17 00:00:00 2001 From: "kentaro.mori" Date: Thu, 8 Mar 2018 22:46:25 +0900 Subject: [PATCH 2/4] Resurrect client connections closing code. --- lib/Server.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Server.js b/lib/Server.js index 71df0f1..1fecadb 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -137,6 +137,12 @@ class Server extends EventEmitter { this.clientOptions.log.stdLog('Closing all connections and exiting...'); } + this.webSocketServer.close(() => { + this.activeConnections.forEach((activeConnection) => { + activeConnection.close(); + }); + }); + this.webSocketServer._server.close(); } From 130d3391ff14b856ccaa7f27cac162fbad1279e4 Mon Sep 17 00:00:00 2001 From: "kentaro.mori" Date: Thu, 8 Mar 2018 22:52:56 +0900 Subject: [PATCH 3/4] Modified the close method of Server as to be saving http-server as a const before ws is going to be deleted. --- lib/Server.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Server.js b/lib/Server.js index 1fecadb..03cd039 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -136,14 +136,14 @@ class Server extends EventEmitter { if (this.clientOptions.log.level >= this.LOGLEVEL.NORMAL) { this.clientOptions.log.stdLog('Closing all connections and exiting...'); } - + + const server = this.webSocketServer._server; this.webSocketServer.close(() => { this.activeConnections.forEach((activeConnection) => { activeConnection.close(); }); }); - - this.webSocketServer._server.close(); + server.clonse(); } newConnection(webSocketConnection) { From 191f8bfa301ecb021c9738b7af0435ae8c514fa8 Mon Sep 17 00:00:00 2001 From: "kentaro.mori" Date: Thu, 8 Mar 2018 23:01:18 +0900 Subject: [PATCH 4/4] Fixed a typo. --- lib/Server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Server.js b/lib/Server.js index 03cd039..34cf1d8 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -143,7 +143,7 @@ class Server extends EventEmitter { activeConnection.close(); }); }); - server.clonse(); + server.close(); } newConnection(webSocketConnection) {