From dc905696310fcc200e6f3565d8205d3fa72b24c8 Mon Sep 17 00:00:00 2001 From: Ruslan Date: Fri, 1 May 2026 16:11:30 +0000 Subject: [PATCH] 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/ visit when an RDP session already exists. --- app/main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/main.py b/app/main.py index 1f06551..1348b59 100644 --- a/app/main.py +++ b/app/main.py @@ -505,6 +505,12 @@ def go_service( _mark("check_existing_ms", t_existing) if existing_user_session: _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) t_limit = time.perf_counter()