1
0
Fork 0
forked from svrjs/svrjs

Enable hangup check and restart

This commit is contained in:
Dorian Niemiec 2024-08-25 19:45:02 +02:00
parent e85f53197c
commit adfd3ff809
2 changed files with 11 additions and 10 deletions

View file

@ -126,12 +126,12 @@ function requestHandler(req, res) {
} }
} }
/*if (req.headers["x-svr-js-from-main-thread"] == "true" && req.socket && (!req.socket.remoteAddress || req.socket.remoteAddress == "::1" || req.socket.remoteAddress == "::ffff:127.0.0.1" || req.socket.remoteAddress == "127.0.0.1" || req.socket.remoteAddress == "localhost" || req.socket.remoteAddress == host || req.socket.remoteAddress == "::ffff:" + host)) { if (req.headers["x-svr-js-from-main-thread"] == "true" && req.socket && (!req.socket.remoteAddress || req.socket.remoteAddress == "::1" || req.socket.remoteAddress == "::ffff:127.0.0.1" || req.socket.remoteAddress == "127.0.0.1" || req.socket.remoteAddress == "localhost" || req.socket.remoteAddress == host || req.socket.remoteAddress == "::ffff:" + host)) {
let headers = config.getCustomHeaders(); let headers = config.getCustomHeaders();
res.writeHead(204, http.STATUS_CODES[204], headers); res.writeHead(204, http.STATUS_CODES[204], headers);
res.end(); res.end();
return; return;
}*/ }
req.url = fixNodeMojibakeURL(req.url); req.url = fixNodeMojibakeURL(req.url);

View file

@ -746,6 +746,7 @@ const serverErrorHandler = require("./handlers/serverErrorHandler.js")(
); );
let reqcounterKillReq = 0; let reqcounterKillReq = 0;
let closedMaster = false; // TODO: closedMaster
let server = {}; let server = {};
let server2 = {}; let server2 = {};
@ -1769,11 +1770,11 @@ function start(init) {
} }
});*/ });*/
/*
// Hangup check and restart // Hangup check and restart
setInterval(function () { setInterval(function () {
if (!closedMaster && !exiting) { if (!closedMaster && !exiting) {
var chksocket = {}; let chksocket = {};
if (process.serverConfig.secure && process.serverConfig.disableNonEncryptedServer) { if (process.serverConfig.secure && process.serverConfig.disableNonEncryptedServer) {
chksocket = https.get({ chksocket = https.get({
hostname: (typeof process.serverConfig.sport == "number" && sListenAddress) ? sListenAddress : "localhost", hostname: (typeof process.serverConfig.sport == "number" && sListenAddress) ? sListenAddress : "localhost",
@ -1839,7 +1840,7 @@ function start(init) {
socketPath: (typeof process.serverConfig.port == "number") ? undefined : process.serverConfig.port, socketPath: (typeof process.serverConfig.port == "number") ? undefined : process.serverConfig.port,
headers: { headers: {
"X-SVR-JS-From-Main-Thread": "true", "X-SVR-JS-From-Main-Thread": "true",
"User-Agent": (exposeServerVersion ? "SVR.JS/" + version + " (" + getOS() + "; " + (process.isBun ? ("Bun/v" + process.versions.bun + "; like Node.JS/" + process.version) : ("Node.JS/" + process.version)) + ")" : "SVR.JS") "User-Agent": generateServerString(true)
}, },
timeout: 1620 timeout: 1620
}, function (res) { }, function (res) {
@ -1859,7 +1860,7 @@ function start(init) {
}); });
} }
} }
}, 4550);*/ }, 4550);
/* /*
// Termination of unused good workers // Termination of unused good workers