fix sleeve memory bug

This commit is contained in:
Olivier Gagnon
2021-09-08 23:47:34 -04:00
parent bada8a5f39
commit 2a13db39c7
360 changed files with 5424 additions and 15764 deletions
+6 -17
View File
@@ -95,20 +95,15 @@ export class BaseServer {
// Text files on this server
textFiles: TextFile[] = [];
constructor(
params: IConstructorParams = { hostname: "", ip: createRandomIp() },
) {
constructor(params: IConstructorParams = { hostname: "", ip: createRandomIp() }) {
this.ip = params.ip ? params.ip : createRandomIp();
this.hostname = params.hostname;
this.organizationName =
params.organizationName != null ? params.organizationName : "";
this.isConnectedTo =
params.isConnectedTo != null ? params.isConnectedTo : false;
this.organizationName = params.organizationName != null ? params.organizationName : "";
this.isConnectedTo = params.isConnectedTo != null ? params.isConnectedTo : false;
//Access information
this.hasAdminRights =
params.adminRights != null ? params.adminRights : false;
this.hasAdminRights = params.adminRights != null ? params.adminRights : false;
}
addContract(contract: CodingContract): void {
@@ -131,10 +126,7 @@ export class BaseServer {
* @returns RunningScript for the specified active script
* Returns null if no such script can be found
*/
getRunningScript(
scriptName: string,
scriptArgs: any[],
): RunningScript | null {
getRunningScript(scriptName: string, scriptArgs: any[]): RunningScript | null {
for (const rs of this.runningScripts) {
if (rs.filename === scriptName && compareArrays(rs.args, scriptArgs)) {
return rs;
@@ -189,10 +181,7 @@ export class BaseServer {
* @returns {IReturnStatus} Return status object indicating whether or not file was deleted
*/
removeFile(fn: string): IReturnStatus {
if (
fn.endsWith(".exe") ||
fn.match(/^.+\.exe-\d+(?:\.\d*)?%-INC$/) != null
) {
if (fn.endsWith(".exe") || fn.match(/^.+\.exe-\d+(?:\.\d*)?%-INC$/) != null) {
for (let i = 0; i < this.programs.length; ++i) {
if (this.programs[i] === fn) {
this.programs.splice(i, 1);