mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-06 21:04:20 +00:00
fix(ui): keep an explicit zero happy-eyeballs delay across the round trip
Follow-up found in review: the wire normalizer still stripped
tryDelayMs when it equaled 0, but with the schema default now 250 a
reload rehydrates the missing field as 250 - a user who explicitly set
0 ("disabled", per the field's own placeholder) would see 250 and any
subsequent save would silently enable a delay they turned off. Keep
tryDelayMs on the wire unconditionally; it is the one happy-eyeballs
field whose presence changes xray's behavior.
Refs #5780
This commit is contained in:
@@ -267,7 +267,6 @@ export function normalizeSockoptForWire(
|
||||
const he = out.happyEyeballs;
|
||||
if (isRecord(he)) {
|
||||
const heOut: Record<string, unknown> = { ...he };
|
||||
if (heOut.tryDelayMs === 0) delete heOut.tryDelayMs;
|
||||
if (heOut.prioritizeIPv6 === false) delete heOut.prioritizeIPv6;
|
||||
if (heOut.interleave === 1) delete heOut.interleave;
|
||||
if (heOut.maxConcurrentTry === 4) delete heOut.maxConcurrentTry;
|
||||
|
||||
@@ -213,6 +213,14 @@ describe('normalizeSockoptForWire', () => {
|
||||
|
||||
expect(out?.happyEyeballs).toEqual({ tryDelayMs: 250 });
|
||||
});
|
||||
|
||||
it('keeps an explicit tryDelayMs of 0 so it cannot rehydrate as the 250 default', () => {
|
||||
const out = normalizeSockoptForWire({
|
||||
happyEyeballs: { tryDelayMs: 0, prioritizeIPv6: true, interleave: 1, maxConcurrentTry: 4 },
|
||||
});
|
||||
|
||||
expect(out?.happyEyeballs).toEqual({ tryDelayMs: 0, prioritizeIPv6: true });
|
||||
});
|
||||
});
|
||||
|
||||
describe('normalizeStreamSettingsForWire reality', () => {
|
||||
|
||||
Reference in New Issue
Block a user