From 6eec8519a9e2e74e7ec986eca518b4142d7365be Mon Sep 17 00:00:00 2001 From: Hans Date: Mon, 22 Aug 2022 18:24:55 +0800 Subject: [PATCH] fix: Server never emits close event if no connections (#156) Fixes #144 --- src/Server.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Server.js b/src/Server.js index 78567cc..6376402 100644 --- a/src/Server.js +++ b/src/Server.js @@ -98,6 +98,7 @@ export default class Server extends EventEmitter { if (callback) this.once('close', callback); this.listening = false; Sockets.close(this._id); + if (this._connections.size === 0) this.emit('close'); return this; }