Fixes
This commit is contained in:
@@ -58,7 +58,7 @@ async function handleStatusRoutes(req, res) {
|
||||
const query = url.parse(req.url, true).query;
|
||||
const probeType = query.probe || 'liveness';
|
||||
|
||||
const dnsHealthy = !!state.dnsPass && state.dnsPass.ready;
|
||||
const dnsHealthy = !!state.dnsPass && state.dnsPass.opened !== false;
|
||||
const proxyHealthy = process.env.DISABLE_PROXY_SERVER !== 'true';
|
||||
const swarmHealthy = state.connectedPeers !== undefined;
|
||||
|
||||
@@ -82,7 +82,7 @@ async function handleStatusRoutes(req, res) {
|
||||
healthy: dnsHealthy,
|
||||
initialized: !!state.dnsPass,
|
||||
details: {
|
||||
passReady: !!state.dnsPass?.ready,
|
||||
passReady: state.dnsPass?.opened !== false,
|
||||
domainsCount: state.domainToIPMap?.size || 0
|
||||
}
|
||||
},
|
||||
|
||||
@@ -214,7 +214,7 @@ function broadcastHealth() {
|
||||
if (adminClients.size === 0) return;
|
||||
|
||||
try {
|
||||
const dnsHealthy = !!state.dnsPass && state.dnsPass.ready;
|
||||
const dnsHealthy = !!state.dnsPass && state.dnsPass.opened !== false;
|
||||
const proxyHealthy = process.env.DISABLE_PROXY_SERVER !== 'true';
|
||||
const swarmHealthy = state.connectedPeers !== undefined;
|
||||
const corestoreHealthy = state.dnsPass && state.dnsPass.base && state.dnsPass.base.writable !== undefined;
|
||||
|
||||
@@ -57,7 +57,7 @@ async function handleStatusRoutes(req, res) {
|
||||
const query = url.parse(req.url, true).query;
|
||||
const probeType = query.probe || 'liveness';
|
||||
|
||||
const dnsHealthy = !!state.dnsPass && state.dnsPass.ready;
|
||||
const dnsHealthy = !!state.dnsPass && state.dnsPass.opened !== false;
|
||||
const proxyHealthy = process.env.DISABLE_PROXY_SERVER !== 'true';
|
||||
const swarmHealthy = state.connectedPeers !== undefined;
|
||||
|
||||
@@ -81,7 +81,7 @@ async function handleStatusRoutes(req, res) {
|
||||
healthy: dnsHealthy,
|
||||
initialized: !!state.dnsPass,
|
||||
details: {
|
||||
passReady: !!state.dnsPass?.ready,
|
||||
passReady: state.dnsPass?.opened !== false,
|
||||
domainsCount: state.domainToIPMap?.size || 0
|
||||
}
|
||||
},
|
||||
|
||||
@@ -60,10 +60,10 @@ const countedTies = new Set(); // Set of tie keys: "domain:claimant"
|
||||
function isDnsPassUsable(pass) {
|
||||
if (!pass) return false;
|
||||
if (pass.closed) return false;
|
||||
if (pass.opened === false) return false;
|
||||
const base = pass.base;
|
||||
if (!base) return false;
|
||||
if (base.closed || base.closing) return false;
|
||||
if (!pass.ready) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Resolve whether this process is the Autopass master (invite authority).
|
||||
* Docker/PM2 often omit argv flags; P2NS_MASTER=true is supported as an alternative to --master.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function resolveIsMaster() {
|
||||
if (process.argv.includes('--master')) return true;
|
||||
const v = process.env.P2NS_MASTER ?? process.env.MASTER;
|
||||
if (v === undefined || v === '') return false;
|
||||
const normalized = String(v).trim().toLowerCase();
|
||||
return normalized === '1' || normalized === 'true' || normalized === 'yes';
|
||||
}
|
||||
|
||||
module.exports = { resolveIsMaster };
|
||||
@@ -68,7 +68,7 @@ module.exports = {
|
||||
holesailStartTimes: new Map(), // Track when each p2p-domain holesail connection was started
|
||||
persistentConnections: new Set(), // Track which connections are persistent
|
||||
localDnsRecords: [],
|
||||
isMaster: process.argv.includes('--master'),
|
||||
isMaster: require('./master-mode').resolveIsMaster(),
|
||||
sendRemovalRequest: null,
|
||||
sendConsensusRequest: null,
|
||||
domainsWithBoth: new Set(),
|
||||
|
||||
Reference in New Issue
Block a user