fix: call connect_rdp_slot on session reuse

Previously connect_rdp_slot was only called when creating a new session.
If the API container restarted, existing sessions had should_be_connected=false
and xfreerdp never started. Now connect is triggered on every /go/<slug> visit
when an RDP session already exists.
This commit is contained in:
2026-05-01 16:11:30 +00:00
parent fc3a4c6efb
commit dc90569631
+6
View File
@@ -505,6 +505,12 @@ def go_service(
_mark("check_existing_ms", t_existing) _mark("check_existing_ms", t_existing)
if existing_user_session: if existing_user_session:
_emit("reuse_session", session_id=existing_user_session.id) _emit("reuse_session", session_id=existing_user_session.id)
if existing_user_session.container_id and existing_user_session.container_id.startswith("RDPSLOT:"):
try:
_rdp_slot_id = int(existing_user_session.container_id.split(":", 1)[1])
threading.Thread(target=connect_rdp_slot, args=(_rdp_slot_id,), daemon=True).start()
except Exception:
pass
return RedirectResponse(url=session_redirect_url(existing_user_session), status_code=303) return RedirectResponse(url=session_redirect_url(existing_user_session), status_code=303)
t_limit = time.perf_counter() t_limit = time.perf_counter()