Skip to content

refactor(server): simplify the preferred-address race from #34 - #41

Merged
Tarquinen merged 1 commit into
devfrom
simplify/pr34
Nov 12, 2026
Merged

Tarquinen merged 1 commit into
devfrom
simplify/pr34

Conversation

@Tarquinen

Copy link
Copy Markdown
Member

Follow-up to #34. No behaviour change.

The race in #34 started the code's addresses first and the rest later, using a null-sentinel channel, a head-start job and two copies of the "start the rest" block. Now every address is launched at once, as before #34, and the others wait on one gate that opens after the 1.5 s head start or once every first address has failed.

  • preferredCandidateURLs folded into firstAttemptURLs; its "every address preferred" case already gave every address
  • redemption no longer puts the redeemed origin first in preferredURLs: it's already one of the code's addresses, and the list is only used as a set
  • OpenCodePairingLink.Listed dropped; Payload has the same fields
  • Fix pairing with dark desktop codes and with a QR's own address #34's parity rows shortened

Kept: the direct-LAN exception (the desktop QR and pair --remote name only the tunnel) and the early start when every first address fails (an unreachable tailnet name fails fast).

Verified: check :feature:settings :server :app passes. On an emulator, with session-lab behind two pairing proxies (A, the code's address, 400 ms late; B, reported, at once) and a pair link naming only A: all traffic goes to A, a relaunch stays on A, stopping A falls back to B, restarting A goes back to A.

No behaviour change.

- ServerLinkStore.race starts every address at once again; addresses
  outside firstAttemptURLs wait on one gate that opens after
  preferredHeadStart or once every first address has failed. This
  replaces the null-sentinel channel, the head-start job and the two
  copies of the "start the rest" block.
- OpenCodeServer.preferredCandidateURLs folded into firstAttemptURLs.
  Its "every address preferred" case already gave every address.
- Pairing redemption no longer puts the redeemed origin first in
  preferredURLs: it is already one of the code's addresses, and
  preferredURLs is only used as a set.
- OpenCodePairingLink's Listed class dropped; Payload has the same
  fields.
- Parity rows for #34 shortened.

Verified: check :feature:settings :server :app on the VM (all pass).
Emulator: session-lab behind two pairing proxies (A, the code's address,
400 ms late; B, reported, at once). Paired by a pair link naming only A:
all traffic to A; relaunch stays on A; A stopped -> B; A restarted -> A.
@Tarquinen
Tarquinen merged commit bba9306 into dev Nov 12, 2026
3 checks passed
Tarquinen added a commit that referenced this pull request Nov 12, 2026
No conflicts. The overscroll files now match dev's #43, and FloatingCall keeps #42's cleanup with the assistant's two internal helpers.

This branch was previously deployed

1 inactive deployment
release — 30bcd3b8 Deployed Nov 11, 2026 by Tarquinen via check #123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant