fix: improve proxy fallback and kill switch logic
This commit is contained in:
parent
5cfad9c72a
commit
46c1808ee9
@ -594,6 +594,8 @@ chrome.proxy.onProxyError.addListener(async (details) => {
|
|||||||
await applyKillSwitch(false);
|
await applyKillSwitch(false);
|
||||||
Utils.log('info', 'Kill switch deactivated after successful fallback');
|
Utils.log('info', 'Kill switch deactivated after successful fallback');
|
||||||
}
|
}
|
||||||
|
// Reset debounce so next error on new proxy triggers immediate fallback
|
||||||
|
lastProxyErrorTime = 0;
|
||||||
broadcastMessage({
|
broadcastMessage({
|
||||||
action: 'statusUpdate',
|
action: 'statusUpdate',
|
||||||
status: 'connected',
|
status: 'connected',
|
||||||
|
|||||||
@ -178,14 +178,10 @@ const ProxyManager = {
|
|||||||
resolve({ working: true, latency });
|
resolve({ working: true, latency });
|
||||||
} else {
|
} else {
|
||||||
Utils.log('debug', `Proxy ${proxy.host}:${proxy.port} returned ${response.status}`);
|
Utils.log('debug', `Proxy ${proxy.host}:${proxy.port} returned ${response.status}`);
|
||||||
// Clear proxy settings on failure
|
|
||||||
chrome.proxy.settings.clear({});
|
|
||||||
resolve({ working: false, latency: null });
|
resolve({ working: false, latency: null });
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Utils.log('debug', `Proxy ${proxy.host}:${proxy.port} failed: ${error.name} - ${error.message}`);
|
Utils.log('debug', `Proxy ${proxy.host}:${proxy.port} failed: ${error.name} - ${error.message}`);
|
||||||
// Clear proxy settings on failure
|
|
||||||
chrome.proxy.settings.clear({});
|
|
||||||
resolve({ working: false, latency: null });
|
resolve({ working: false, latency: null });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -419,7 +415,9 @@ const ProxyManager = {
|
|||||||
return { success: true, proxy: proxyWithLatency, error: null };
|
return { success: true, proxy: proxyWithLatency, error: null };
|
||||||
}
|
}
|
||||||
|
|
||||||
return { success: false, proxy: null, error: 'Failed to apply proxy settings' };
|
// applyProxy failed - try next proxy instead of giving up
|
||||||
|
Utils.log('warn', `Failed to apply proxy ${proxy.host}:${proxy.port} with full config, trying next...`);
|
||||||
|
return this.fallbackToNext(attemptCount + 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user