From d7a37b5eb3d14de07de3f8b28b4d430ed103983e Mon Sep 17 00:00:00 2001 From: Alex P Date: Thu, 23 Oct 2025 18:47:28 +0300 Subject: [PATCH] fix: prevent timeout ping-pong loop in emergency promotions --- session_manager.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/session_manager.go b/session_manager.go index fe16e8ec..80543800 100644 --- a/session_manager.go +++ b/session_manager.go @@ -1223,11 +1223,11 @@ func (sm *SessionManager) transferPrimaryRole(fromSessionID, toSessionID, transf return fmt.Errorf("cannot promote: another primary session exists (%s)", existingPrimaryID) } - // Promote target session toSession.Mode = SessionModePrimary toSession.hidRPCAvailable = false - // For manual transfers, preserve the session's actual LastActive timestamp - // Emergency promotions inherit the observer's activity state - no free time + if transferType == "emergency_timeout_promotion" { + toSession.LastActive = time.Now() + } sm.primarySessionID = toSessionID // ALWAYS set lastPrimaryID to the new primary to support WebRTC reconnections