refactor: 0 error

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2019-07-10 15:59:04 +08:00
parent cbc0ed72c4
commit 4527e437fa
39 changed files with 1802 additions and 1695 deletions

View File

@@ -78,7 +78,7 @@ module.exports = class CCode extends require("./base")
if (bUpdate) {
UpdateCodeFiles(VersionNum)
}
if (global.global.START_LOAD_CODE.StartLoad) {
if (global.START_LOAD_CODE.StartLoad) {
global.CODE_VERSION = global.START_LOAD_CODE.StartLoad
this.ClearLoadCode()
}
@@ -95,8 +95,8 @@ module.exports = class CCode extends require("./base")
var file_handle = fs.openSync(fname2, "w");
fs.writeSync(file_handle, data, 0, data.length)
fs.closeSync(file_handle)
var SignArr = arr2(Hash, GetArrFromValue(Data.VersionNum));
var Sign = secp256k1.sign(SHA3BUF(SignArr), PrivateKey).signature;
var SignArr = global.arr2(Hash, global.GetArrFromValue(Data.VersionNum));
var Sign = global.secp256k1.sign(global.SHA3BUF(SignArr), PrivateKey).signature;
global.CODE_VERSION = Data
global.CODE_VERSION.Hash = Hash
global.CODE_VERSION.Sign = Sign
@@ -150,10 +150,10 @@ global.UnpackCodeFile = UnpackCodeFile;
function UnpackCodeFile(fname) {
var data = fs.readFileSync(fname);
var reader = ZIP.Reader(data);
var reader = global.ZIP.Reader(data);
reader.forEach(function(entry) {
var Name = entry.getName();
var Path = GetCodePath(Name);
var Path = global.GetCodePath(Name);
if (entry.isFile()) {
var buf = entry.getData();
global.CheckCreateDir(Path, true, true);
@@ -171,7 +171,7 @@ global.RestartNode = function RestartNode(bForce) {
setTimeout(DoExit, 5000);
if (global.nw || global.NWMODE) {
} else {
StopChildProcess();
global.StopChildProcess();
global.ToLog("********************************** FORCE RESTART!!!");
return;
}
@@ -179,12 +179,12 @@ global.RestartNode = function RestartNode(bForce) {
var it = this.ActualNodes.iterator(), Node;
while ((Node = it.next()) !== null) {
if (Node.Socket)
CloseSocket(Node.Socket, "Restart");
global.CloseSocket(Node.Socket, "Restart");
}
}
this.StopServer();
this.StopNode();
StopChildProcess();
global.StopChildProcess();
global.ToLog("****************************************** RESTART!!!");
global.ToLog("EXIT 1");
};
@@ -195,7 +195,7 @@ function DoExit() {
global.ToLog("RESTART NW");
var StrRun = '"' + process.argv[0] + '" .\n';
StrRun += '"' + process.argv[0] + '" .\n';
SaveToFile("run-next.bat", StrRun);
global.SaveToFile("run-next.bat", StrRun);
const child_process = require('child_process');
child_process.exec("run-next.bat", { shell: true });
}