From adb92084913b2df284e860f376a0d265997a5369 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Tue, 25 May 2021 11:06:01 +1000 Subject: [PATCH] do not retry Oxen Server Error --- ts/session/snode_api/onions.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/ts/session/snode_api/onions.ts b/ts/session/snode_api/onions.ts index e5e811846..b0dcd93b5 100644 --- a/ts/session/snode_api/onions.ts +++ b/ts/session/snode_api/onions.ts @@ -264,13 +264,17 @@ async function processAnyOtherErrorOnPath( nodeNotFound = ciphertext.substr(NEXT_NODE_NOT_FOUND_PREFIX.length); } + if (ciphertext === 'Oxen Server error') { + window?.log?.warn('[path] Got Oxen server Error. Not much to do if the server has troubles.'); + throw new pRetry.AbortError('Oxen Server error'); + } + // If we have a specific node in fault we can exclude just this node. // Otherwise we increment the whole path failure count if (nodeNotFound) { await incrementBadSnodeCountOrDrop({ snodeEd25519: nodeNotFound, associatedWith, - isNodeNotFound: true, }); // we are checking errors on the path, a nodeNotFound on the path should trigger a rebuild @@ -543,22 +547,16 @@ async function handle421InvalidSwarm(snodeEd25519: string, body: string, associa export async function incrementBadSnodeCountOrDrop({ snodeEd25519, associatedWith, - isNodeNotFound, }: { snodeEd25519: string; associatedWith?: string; - isNodeNotFound?: boolean; }) { const oldFailureCount = snodeFailureCount[snodeEd25519] || 0; const newFailureCount = oldFailureCount + 1; snodeFailureCount[snodeEd25519] = newFailureCount; - if (newFailureCount >= snodeFailureThreshold || isNodeNotFound) { - if (isNodeNotFound) { - window?.log?.warn(`Node not found reported for: ${snodeEd25519}; dropping it.`); - } else { - window?.log?.warn(`Failure threshold reached for: ${snodeEd25519}; dropping it.`); - } + if (newFailureCount >= snodeFailureThreshold) { + window?.log?.warn(`Failure threshold reached for: ${snodeEd25519}; dropping it.`); if (associatedWith) { window?.log?.info(`Dropping ${snodeEd25519} from swarm of ${associatedWith}`);