From 0560f3d42069d650faadb7b172861c64a0fdcb4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <michael@minelli.me> Date: Wed, 21 Feb 2024 00:39:04 +0100 Subject: [PATCH] SessionManager => Bug fix: stop all connection when login is finished Before the server was closed only when the user close the tab or the browser --- NodeApp/src/managers/SessionManager.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NodeApp/src/managers/SessionManager.ts b/NodeApp/src/managers/SessionManager.ts index 4f1d25d..b5175f8 100644 --- a/NodeApp/src/managers/SessionManager.ts +++ b/NodeApp/src/managers/SessionManager.ts @@ -38,11 +38,11 @@ class LoginServer { if ( req.url?.match(Config.login.server.route) ) { const urlParts = req.url.split('='); if ( urlParts.length > 0 ) { - this.events.emit('code', urlParts[1]); - res.writeHead(HttpStatusCode.Ok, { 'Content-Type': 'text/html' }); res.write(`<html lang="en"><body><h1 style="color: green">DojoCLI login successful</h1><h3>You can close this window.</h3></body></html>`); res.end(); + + this.events.emit('code', urlParts[1]); return; } @@ -66,6 +66,7 @@ class LoginServer { stop() { try { this.server.close(); + this.server.closeAllConnections(); this.events.emit('stopped'); } catch ( error ) { this.events.emit('error', error); -- GitLab