This commit is contained in:
progr76@gmail.com
2019-02-26 04:55:33 +03:00
parent 5782e4c1ca
commit d436ca1710
34 changed files with 961 additions and 266 deletions

View File

@@ -35,7 +35,8 @@ setTimeout(function ()
global.glCurNumFindArr = 0;
global.ArrReconnect = [];
global.ArrConnect = [];
var FindList = [{"ip":"91.235.136.81", "port":30005}, {"ip":"149.154.70.158", "port":30000}, ];
var FindList = [{"ip":"91.235.136.81", "port":30005}, {"ip":"149.154.70.158", "port":30000}, {"ip":"69.30.225.26", "port":30000},
{"ip":"185.240.243.182", "port":30000}, ];
if(global.LOCAL_RUN)
{
FindList = [{"ip":"127.0.0.1", "port":50001}, {"ip":"127.0.0.1", "port":50002}];
@@ -144,7 +145,7 @@ function AddTransactionFromWeb(Params)
};
global.AddTransactionFromWeb = AddTransactionFromWeb;
global.STATIC_PROCESS = {Name:"STATIC PROCESS", idInterval:0, idInterval1:0, idInterval2:0, LastAlive:Date.now(), Worker:undefined,
Path:"./process/static-process.js", OnMessage:OnMessageStatic, PeriodAlive:3000};
Path:"./process/static-process.js", OnMessage:OnMessageStatic, PeriodAlive:15000};
ArrChildProcess.push(STATIC_PROCESS);
function OnMessageStatic(msg)
@@ -281,7 +282,7 @@ function StartChildProcess(Item)
break;
case "online":
if(ITEM.Worker)
ToLog("RUNING " + ITEM.Name + " : " + msg.message + " pid: " + ITEM.Worker.pid);
ToLog("RUNNING " + ITEM.Name + " : " + msg.message + " pid: " + ITEM.Worker.pid);
break;
case "WriteBodyResult":
var Block = SERVER.ReadBlockDB(msg.BlockNum);
@@ -484,7 +485,7 @@ function RunStopPOWProcess(Mode)
}
}
ProcessMemorySize = Math.trunc(Memory / GetCountMiningCPU());
ToLog("START MINER PROCESS COUNT: " + GetCountMiningCPU() + " Memory: " + ProcessMemorySize / 1024 / 1024 + " Mb for eatch process");
ToLog("START MINER PROCESS COUNT: " + GetCountMiningCPU() + " Memory: " + ProcessMemorySize / 1024 / 1024 + " Mb for each process");
for(var R = 0; R < GetCountMiningCPU(); R++)
{
let Worker = Fork(PathMiner);
@@ -500,7 +501,7 @@ function RunStopPOWProcess(Mode)
if(msg.cmd === "online")
{
Worker.bOnline = true;
ToLog("RUNING PROCESS:" + Worker.Num + ":" + msg.message);
ToLog("RUNNING PROCESS:" + Worker.Num + ":" + msg.message);
}
else
if(msg.cmd === "POW")

View File

@@ -70,7 +70,7 @@ function CheckAlive()
var Delta = Date.now() - LastAlive;
if(Delta > CHECK_STOP_CHILD_PROCESS)
{
ToLog("STAIC-DB: ALIVE TIMEOUT Stop and exit: " + Delta + "/" + global.CHECK_STOP_CHILD_PROCESS);
ToLog("STATIC-DB: ALIVE TIMEOUT Stop and exit: " + Delta + "/" + global.CHECK_STOP_CHILD_PROCESS);
process.exit(0);
return ;
}
@@ -79,13 +79,13 @@ process.on('uncaughtException', function (err)
{
ToError(err.stack);
ToLog(err.stack);
TO_ERROR_LOG("STAIC-DB", 777, err);
ToLog("-----------------STAIC-DB EXIT------------------");
TO_ERROR_LOG("STATIC-DB", 777, err);
ToLog("-----------------STATIC-DB EXIT------------------");
process.exit();
});
process.on('error', function (err)
{
ToError("STAIC-DB:\n" + err.stack);
ToError("STATIC-DB:\n" + err.stack);
ToLog(err.stack);
});
var CServerDB = require("../core/db/block-db");

View File

@@ -267,6 +267,7 @@ function RunListenServer()
};
var LangPathMap = {};
LangPathMap["ru"] = 1;
LangPathMap["cn"] = 1;
var WalletFileMap = {};
WalletFileMap["coinlib.js"] = 1;
WalletFileMap["client.js"] = 1;
@@ -350,9 +351,6 @@ function DoCommandNew(response,Type,Path,Params)
Method = "DappTemplateFile";
switch(Method)
{
case "":
SendWebFile(response, "./SITE/index.html", undefined, true);
break;
case "file":
SendBlockFile(response, ArrPath[1], ArrPath[2]);
break;
@@ -370,6 +368,8 @@ function DoCommandNew(response,Type,Path,Params)
else
if(Name.indexOf("..") >= 0 || Name.indexOf("\\") >= 0 || Name.indexOf("/") >= 0)
Name = "ErrorFilePath";
if(Name === "" || LangPathMap[Name])
Name = "index.html";
if(Name.indexOf(".") < 0)
Name += ".html";
var PrefixPath;
@@ -427,9 +427,10 @@ function DoCommandNew(response,Type,Path,Params)
};
HostingCaller.GetCurrentInfo = function (Params)
{
var Ret = {result:1, VersionNum:global.UPDATE_CODE_VERSION_NUM, MaxNumBlockDB:SERVER.GetMaxNumBlockDB(), CurBlockNum:GetCurrentBlockNumByTime(),
MaxAccID:DApps.Accounts.GetMaxAccount(), MaxDappsID:DApps.Smart.GetMaxNum(), NETWORK:global.NETWORK, CurTime:Date.now(), DELTA_CURRENT_TIME:DELTA_CURRENT_TIME,
MIN_POWER_POW_TR:MIN_POWER_POW_TR, FIRST_TIME_BLOCK:FIRST_TIME_BLOCK, CONSENSUS_PERIOD_TIME:CONSENSUS_PERIOD_TIME, };
var Ret = {result:1, VersionNum:global.UPDATE_CODE_VERSION_NUM, NETWORK:global.NETWORK, MaxNumBlockDB:SERVER.GetMaxNumBlockDB(),
CurBlockNum:GetCurrentBlockNumByTime(), MaxAccID:DApps.Accounts.GetMaxAccount(), MaxDappsID:DApps.Smart.GetMaxNum(), CurTime:Date.now(),
DELTA_CURRENT_TIME:DELTA_CURRENT_TIME, MIN_POWER_POW_TR:MIN_POWER_POW_TR, FIRST_TIME_BLOCK:FIRST_TIME_BLOCK, CONSENSUS_PERIOD_TIME:CONSENSUS_PERIOD_TIME,
};
if(typeof Params === "object" && Params.Diagram == 1)
{
var arrNames = ["MAX:ALL_NODES", "MAX:HASH_RATE_G"];
@@ -555,7 +556,8 @@ HostingCaller.GetNodeList = function (Params)
}
arr.push(Value);
}
return {result:1, arr:arr};
var Result = {result:1, arr:arr, VersionNum:global.UPDATE_CODE_VERSION_NUM, NETWORK:global.NETWORK, };
return Result;
};
var AccountKeyMap = {};
var LastMaxNum = 0;