diff options
-rw-r--r-- | src/server/DashSession.ts | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/server/DashSession.ts b/src/server/DashSession.ts index 10086702f..56610874e 100644 --- a/src/server/DashSession.ts +++ b/src/server/DashSession.ts @@ -34,13 +34,7 @@ export class DashSessionAgent extends Session.AppliedSessionAgent { protected async launchServerWorker() { const worker = Session.ServerWorker.Create(launchServer); // server initialization delegated to worker - worker.addExitHandler(reason => { - const { _socket } = WebSocket; - if (_socket) { - const message = typeof reason === "boolean" ? (reason ? "exit" : "temporary") : "crash"; - Utils.Emit(_socket, MessageStore.ConnectionTerminated, message); - } - }); + worker.addExitHandler(this.notifyClient); return worker; } @@ -49,7 +43,7 @@ export class DashSessionAgent extends Session.AppliedSessionAgent { // this sends a pseudorandomly generated guid to the configuration's recipients, allowing them alone // to kill the server via the /kill/:key route const content = `The key for this session (started @ ${new Date().toUTCString()}) is ${key}.\n\n${this.signature}`; - const failures = await Email.dispatchAll(this.notificationRecipients, "Server Termination Key", content); + const failures = await Email.dispatchAll(this.notificationRecipients, "Dash Release Session Admin Authentication Key", content); if (failures) { failures.map(({ recipient, error: { message } }) => this.sessionMonitor.mainLog(red(`dispatch failure @ ${recipient} (${yellow(message)})`))); return false; @@ -91,6 +85,14 @@ export class DashSessionAgent extends Session.AppliedSessionAgent { } } + private notifyClient: Session.ExitHandler = reason => { + const { _socket } = WebSocket; + if (_socket) { + const message = typeof reason === "boolean" ? (reason ? "exit" : "temporary") : "crash"; + Utils.Emit(_socket, MessageStore.ConnectionTerminated, message); + } + } + private backup = async () => this.sessionMonitor.exec("backup.bat", { cwd: this.releaseDesktop }); private async dispatchZippedDebugBackup(mode: string, recipient: string) { |