Devices: route to the saved headset before serving; a headset removed elsewhere mid-install reaches nothing (review round 28)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
saphidandClaude Opus 5.5 committed 2026-09-29 08:01:32 +10:00
1 parent 409e328880
commit 747dbcf72f
3 files changed
+33 -2

No files matched your search

+9 -1
View File
@@ -242,6 +242,11 @@ class Link:
# ---- control from the server ----
def start(self):
# Route to the saved headset before the server takes requests: until the connector
# has run, commands (an upload by scp, say) would otherwise go to the default alias.
device = self.active_device()
with self.route_lock:
self.apply(device["alias"], self.first_route(device))
self.thread = threading.Thread(target=self.run, name="frame-link", daemon=True)
self.thread.start()
@@ -348,7 +353,10 @@ class Link:
try:
return self.reg.get(want)
except frame_devices.DeviceError:
pass
# Removed (by another server). Mid-install, fail closed: the rest of the
# install, or its clean-up, mustn't land on whichever headset comes next.
if self.work():
return self.NONE
devices = self.reg.devices()
if devices:
return devices[0]