Skip to content

OSCDestination: a slow lookup finishing after a newer connect takes the destination back #135

Closed

Description

@Skeyelab

Parent

#12

What's wrong

Found in the pre-merge review of #129 (#84, #109). OSCDestination.connect installs whatever it opens, whenever its lookup finishes. A slow name lookup that finishes after a newer connect takes the destination back to the old host. This can happen with:

  • launch's connectOSC and an Apply
  • Apply and reresolve() after a failing send or a wake

A probe on the #129 branch reproduces it: connect old-studio.local (lookup held), connect 192.168.1.20 (succeeds), release the lookup, then send. The message goes to 10.0.0.9, the old host, not to 192.168.1.20.

The app has the same race. connectOSC's failure branch sets status.problem (oscSender) when the launch lookup times out, even if an Apply has since opened a working host.

Fix

Give each connect a generation (or compare against state.target under the lock). Only the latest one may install its sink and report lastError or onReady. An older one returns its result without touching the state. The app ignores a stale connectOSC result in the same way.

Acceptance criteria

  • A connect that finishes after a newer one changes nothing: sends go to the newer host, and lastError and onReady are the newer one's.
  • reresolve() started before an Apply doesn't undo it.
  • Test-first with /tdd at the OSCDestination seam, with a gated fake resolver.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions