diff --git a/ivette/src/frama-c/server.ts b/ivette/src/frama-c/server.ts index 163b7a6b572f3a472d037ed324f7e12c3f9fc37f..c5b222c29a4e67f218b1e7f496cf11a3736839a5 100644 --- a/ivette/src/frama-c/server.ts +++ b/ivette/src/frama-c/server.ts @@ -153,20 +153,20 @@ let queueId: string[] = []; /** Polling timeout and timer. */ const pollingTimeout = 50; -let pollingTimer: NodeJS.Timeout | null = null; +let pollingTimer: NodeJS.Timeout | undefined; /** Flushing timer. */ -let flushingTimer: NodeJS.Immediate | null = null; +let flushingTimer: NodeJS.Immediate | undefined; /** Server process. */ -let process: ChildProcess | null = null; +let process: ChildProcess | undefined; /** Killing timeout and timer for server process hard kill. */ const killingTimeout = 300; -let killingTimer: NodeJS.Timeout | null = null; +let killingTimer: NodeJS.Timeout | undefined; /** ZMQ (REQ) socket. */ -let zmqSocket: ZmqRequest | null = null; +let zmqSocket: ZmqRequest | undefined; /** Flag on whether ZMQ socket is busy. */ let zmqIsBusy = false; @@ -543,15 +543,15 @@ function _reset() { pending = {}; if (flushingTimer) { clearImmediate(flushingTimer); - flushingTimer = null; + flushingTimer = undefined; } if (pollingTimer) { clearTimeout(pollingTimer); - pollingTimer = null; + pollingTimer = undefined; } if (killingTimer) { clearTimeout(killingTimer); - killingTimer = null; + killingTimer = undefined; } } @@ -588,10 +588,10 @@ function _exit(error?: Error) { _reset(); if (zmqSocket) { zmqSocket.close(); - zmqSocket = null; + zmqSocket = undefined; } zmqIsBusy = false; - process = null; + process = undefined; if (status.stage === Stage.RESTARTING) { setImmediate(start); } else if (error) { @@ -846,7 +846,7 @@ function _waiting() { function _flush() { if (!flushingTimer) { flushingTimer = setImmediate(() => { - flushingTimer = null; + flushingTimer = undefined; _send(); }); } @@ -856,7 +856,7 @@ function _poll() { if (!pollingTimer) { const delay = (config && config.polling) || pollingTimeout; pollingTimer = setTimeout(() => { - pollingTimer = null; + pollingTimer = undefined; _send(); }, delay); } diff --git a/ivette/src/frama-c/states.ts b/ivette/src/frama-c/states.ts index 1cf0620f980274132c3780c32c0664674269caaa..51001468a77b24dcc6f70501dd8d37b8bba9e048 100644 --- a/ivette/src/frama-c/states.ts +++ b/ivette/src/frama-c/states.ts @@ -46,7 +46,7 @@ class PP { // --- Synchronized Current Project // -------------------------------------------------------------------------- -let currentProject: string | null = null; +let currentProject: string | undefined; let states: any = {}; const stateDefaults: any = {}; @@ -107,12 +107,12 @@ export async function setProject(project: string) { // --- Projectified State // -------------------------------------------------------------------------- -function getValue(id: string, project: string | null) { +function getValue(id: string, project?: string) { if (!project) return undefined; return _.get(states, [project, id], stateDefaults[id]); } -function setValue(id: string, project: string | null, value: any) { +function setValue(id: string, project: string | undefined, value: any) { if (!project) return; _.set(states, [project, id], value); Dome.emit(STATE + id, value);