aboutsummaryrefslogtreecommitdiff
path: root/src/server/DashSession/Session
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/DashSession/Session')
-rw-r--r--src/server/DashSession/Session/agents/monitor.ts10
-rw-r--r--src/server/DashSession/Session/agents/promisified_ipc_manager.ts8
-rw-r--r--src/server/DashSession/Session/agents/server_worker.ts8
-rw-r--r--src/server/DashSession/Session/utilities/session_config.ts2
4 files changed, 15 insertions, 13 deletions
diff --git a/src/server/DashSession/Session/agents/monitor.ts b/src/server/DashSession/Session/agents/monitor.ts
index ee8afee65..0fdaf07ff 100644
--- a/src/server/DashSession/Session/agents/monitor.ts
+++ b/src/server/DashSession/Session/agents/monitor.ts
@@ -2,7 +2,7 @@ import { ExitHandler } from "./applied_session_agent";
import { Configuration, configurationSchema, defaultConfig, Identifiers, colorMapping } from "../utilities/session_config";
import Repl, { ReplAction } from "../utilities/repl";
import { isWorker, setupMaster, on, Worker, fork } from "cluster";
-import { manage, MessageHandler } from "./promisified_ipc_manager";
+import { manage, MessageHandler, ErrorLike } from "./promisified_ipc_manager";
import { red, cyan, white, yellow, blue } from "colors";
import { exec, ExecOptions } from "child_process";
import { validate, ValidationError } from "jsonschema";
@@ -22,7 +22,7 @@ export class Monitor extends IPCMessageReceiver {
private readonly config: Configuration;
private activeWorker: Worker | undefined;
private key: string | undefined;
- // private repl: Repl;
+ private repl: Repl;
public static Create() {
if (isWorker) {
@@ -46,7 +46,7 @@ export class Monitor extends IPCMessageReceiver {
this.configureInternalHandlers();
this.config = this.loadAndValidateConfiguration();
this.initializeClusterFunctions();
- // this.repl = this.initializeRepl();
+ this.repl = this.initializeRepl();
}
protected configureInternalHandlers = () => {
@@ -90,7 +90,7 @@ export class Monitor extends IPCMessageReceiver {
}
public readonly coreHooks = Object.freeze({
- onCrashDetected: (listener: MessageHandler<{ error: Error }>) => this.on(Monitor.IntrinsicEvents.CrashDetected, listener),
+ onCrashDetected: (listener: MessageHandler<{ error: ErrorLike }>) => this.on(Monitor.IntrinsicEvents.CrashDetected, listener),
onServerRunning: (listener: MessageHandler<{ isFirstTime: boolean }>) => this.on(Monitor.IntrinsicEvents.ServerRunning, listener)
});
@@ -119,7 +119,7 @@ export class Monitor extends IPCMessageReceiver {
* that can invoke application logic external to this module
*/
public addReplCommand = (basename: string, argPatterns: (RegExp | string)[], action: ReplAction) => {
- // this.repl.registerCommand(basename, argPatterns, action);
+ this.repl.registerCommand(basename, argPatterns, action);
}
public exec = (command: string, options?: ExecOptions) => {
diff --git a/src/server/DashSession/Session/agents/promisified_ipc_manager.ts b/src/server/DashSession/Session/agents/promisified_ipc_manager.ts
index feff568e1..95aa686e6 100644
--- a/src/server/DashSession/Session/agents/promisified_ipc_manager.ts
+++ b/src/server/DashSession/Session/agents/promisified_ipc_manager.ts
@@ -43,8 +43,8 @@ type InternalMessageHandler = (message: InternalMessage) => (any | Promise<any>)
* Allows for the transmission of the error's key features over IPC.
*/
export interface ErrorLike {
- name?: string;
- message?: string;
+ name: string;
+ message: string;
stack?: string;
}
@@ -162,8 +162,8 @@ export class PromisifiedIPCManager {
}
if (!this.isDestroyed && this.target.send) {
const metadata = { id, isResponse: true };
- const response: Response = { results , error };
- const message = { name, args: response , metadata };
+ const response: Response = { results, error };
+ const message = { name, args: response, metadata };
delete this.pendingMessages[id];
this.target.send(message);
}
diff --git a/src/server/DashSession/Session/agents/server_worker.ts b/src/server/DashSession/Session/agents/server_worker.ts
index 976d27226..afa5fc68d 100644
--- a/src/server/DashSession/Session/agents/server_worker.ts
+++ b/src/server/DashSession/Session/agents/server_worker.ts
@@ -1,6 +1,6 @@
import { ExitHandler } from "./applied_session_agent";
import { isMaster } from "cluster";
-import { manage } from "./promisified_ipc_manager";
+import { manage, ErrorLike } from "./promisified_ipc_manager";
import IPCMessageReceiver from "./process_message_router";
import { red, green, white, yellow } from "colors";
import { get } from "request-promise";
@@ -112,7 +112,9 @@ export class ServerWorker extends IPCMessageReceiver {
private proactiveUnplannedExit = async (error: Error): Promise<void> => {
this.shouldServerBeResponsive = false;
// communicates via IPC to the master thread that it should dispatch a crash notification email
- this.emit(Monitor.IntrinsicEvents.CrashDetected, { error });
+ const { name, message, stack } = error;
+ const deconstructed_error: ErrorLike = { name, message, stack };
+ this.emit(Monitor.IntrinsicEvents.CrashDetected, { error: deconstructed_error });
await this.executeExitHandlers(error);
// notify master thread (which will log update in the console) of crash event via IPC
this.lifecycleNotification(red(`crash event detected @ ${new Date().toUTCString()}`));
@@ -157,4 +159,4 @@ export class ServerWorker extends IPCMessageReceiver {
this.pollServer();
}
-} \ No newline at end of file
+}
diff --git a/src/server/DashSession/Session/utilities/session_config.ts b/src/server/DashSession/Session/utilities/session_config.ts
index b0e65dde4..bde98e9d2 100644
--- a/src/server/DashSession/Session/utilities/session_config.ts
+++ b/src/server/DashSession/Session/utilities/session_config.ts
@@ -19,7 +19,7 @@ const identifierProperties: Schema = {
const portProperties: Schema = {
type: "number",
- minimum: 1024,
+ minimum: 443,
maximum: 65535
};