aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2020-01-09 23:12:23 -0500
committerSam Wilkins <samwilkins333@gmail.com>2020-01-09 23:12:23 -0500
commit883f0d3a331dcc700a12f42258e8339451d39b5e (patch)
tree86f161ab8c9c51b2ad8c475da7e5d95b7c766e53 /src
parentceafdaf22b3410c290000cbbd90896e3b5c21cf3 (diff)
rearrangement
Diffstat (limited to 'src')
-rw-r--r--src/server/DashSession.ts18
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) {