mirror of
https://github.com/saphid/frame-control.git
synced 2026-10-06 10:00:34 +02:00
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:
1 parent
409e328880
commit
747dbcf72f
3 files changed
+33
-2
No files matched your search
+3
-1
@@ -464,8 +464,10 @@ class Registry:
|
||||
# The headset in use is this server's own choice: another server picking a
|
||||
# different one mustn't move commands (an install, say) under it. The file's
|
||||
# choice is only where a server starts.
|
||||
# Kept even if another server removed it, so the connector can see that
|
||||
# (and not quietly move to another headset in the middle of an install).
|
||||
mine = self.data.get("active")
|
||||
if mine and any(d["id"] == mine for d in data["devices"]):
|
||||
if mine:
|
||||
data["active"] = mine
|
||||
self.data = data
|
||||
|
||||
|
||||
+9
-1
@@ -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]
|
||||
|
||||
Reference in new issue
Block a user