sync: sync upstream code

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2019-08-01 16:50:55 +08:00
parent c666069889
commit eeb045687c
12 changed files with 112 additions and 103 deletions

View File

@@ -45,7 +45,6 @@ global.CONST_NAME_ARR = [
"RESTART_PERIOD_SEC",
"MAX_GRAY_CONNECTIONS_TO_SERVER",
"TRANSACTION_PROOF_COUNT",
"UPDATE_NUM_COMPLETE",
"LIMIT_SEND_TRAFIC",
"WATCHDOG_DEV",
"ADDRLIST_MODE",
@@ -78,7 +77,7 @@ global.WATCHDOG_BADACCOUNT = 1;
global.WATCHDOG_DEV = 0;
global.RESYNC_CONDITION = { "OWN_BLOCKS": 20, "K_POW": 5 };
global.REST_BLOCK_SCALE = 1000;
global.REST_START_COUNT = 1000;
global.REST_START_COUNT = 10000;
global.LOAD_TO_BEGIN = 2;
global.DEBUG_WALLET = 0;
global.CHECK_GLOBAL_TIME = 1;
@@ -91,7 +90,6 @@ global.USE_NET_FOR_SERVER_ADDRES = 1;
global.NET_WORK_MODE = undefined;
global.STAT_MODE = 0;
global.MAX_STAT_PERIOD = 1 * 3600;
global.UPDATE_NUM_COMPLETE = 0;
global.WALLET_NAME = "TERA";
global.WALLET_DESCRIPTION = "";
global.USE_MINING = 0;

View File

@@ -35,14 +35,13 @@ ContenTypeMap["html"] = "text/html";
ContenTypeMap["txt"] = "text/plain";
ContenTypeMap["csv"] = "text/csv";
ContenTypeMap["svg"] = "image/svg+xml";
ContenTypeMap[""] = "application/octet-stream";
ContenTypeMap["zip"] = "application/zip";
ContenTypeMap["pdf"] = "application/pdf";
ContenTypeMap["exe"] = "application/octet-stream";
ContenTypeMap["msi"] = "application/octet-stream";
ContenTypeMap["woff"] = "application/font-woff";
ContenTypeMap["html"] = "text/html";
ContenTypeMap["psd"] = "application/octet-stream";
var DefaultContentType = "application/octet-stream";
global.HTTPCaller = {};
function DoCommand(response, Type, Path, params, remoteAddress) {
@@ -1355,8 +1354,8 @@ var MapFileHTML5 = {};
function SendWebFile(response, name?, StrCookie?, bParsing?) {
var type = name.substr(name.length - 4, 4);
if (type.substr(0, 1) === ".")
type = type.substr(1);
var index1 = type.indexOf(".");
type = type.substr(index1 + 1);
var Path;
if (name.substr(0, 2) !== "./")
Path = "./" + name;
@@ -1373,7 +1372,9 @@ function SendWebFile(response, name?, StrCookie?, bParsing?) {
return;
}
var StrContentType = ContenTypeMap[type];
if (!StrContentType || StrContentType === "text/html") {
if (!StrContentType)
StrContentType = DefaultContentType;
if (StrContentType === "text/html") {
var Headers = { 'Content-Type': 'text/html', "X-Frame-Options": "sameorigin" };
if (StrCookie)
Headers['Set-Cookie'] = StrCookie;
@@ -1566,8 +1567,10 @@ function SetSafeResponce(response) {
response._writeHead = response.writeHead;
response.end = function() {
try {
if (arguments && arguments[0] && arguments[0].length) {
if (global.STAT_MODE === 2 && arguments && arguments[0] && arguments[0].length) {
global.ADD_TO_STAT("HTTP_SEND", arguments[0].length);
if (response.DetailStatName)
global.ADD_TO_STAT("HTTP_SEND" + response.DetailStatName, arguments[0].length);
}
response._end.apply(response, arguments);
}

View File

@@ -294,12 +294,13 @@ function CheckGlobalTime() {
global.DELTA_CURRENT_TIME = global.DELTA_CURRENT_TIME * -1;
setTimeout(() => {
global.DELTA_CURRENT_TIME = global.DELTA_CURRENT_TIME * -1
// if (!global.CAN_START) {
// global.DELTA_CURRENT_TIME = global.DELTA_CURRENT_TIME + 3000;
// setTimeout(() => {
// global.DELTA_CURRENT_TIME = global.DELTA_CURRENT_TIME - 3000;
// }, 3000)
// }
if (!global.CAN_START) {
let temp = global.DELTA_CURRENT_TIME
global.DELTA_CURRENT_TIME = 3000;
setTimeout(() => {
global.DELTA_CURRENT_TIME = temp;
}, 3000)
}
}, 3000)
}, 5000)
global.SAVE_CONST();