Fix idle session breaking resize and input on reconnect
Two bugs introduced in the idle tracker pause commit: 1. handleOutput() short-circuited entirely when idle, skipping connector.OnData() — so terminal output never reached clients even after reconnecting. Fix: still call connector.OnData() during idle; only skip the expensive tracker.Feed(). 2. When a WebSocket client reconnects to an existing session, handleWebSocket never called UpdateConnector(), so the idle flag was never cleared and the tracker stayed paused. Fix: create a fresh connector and call session.UpdateConnector() on reconnect, which clears idle and rebuilds the tracker.
This commit is contained in:
@@ -515,6 +515,13 @@ func (s *LocalServer) handleWebSocket(w http.ResponseWriter, r *http.Request) {
|
||||
session := s.sessionManager.GetSession(sessionID)
|
||||
if session != nil && session.IsRunning() {
|
||||
sessionCreated = true
|
||||
// Clear idle state so the output pipeline resumes fully
|
||||
connector := &localClientConnector{
|
||||
server: s,
|
||||
sessionID: sessionID,
|
||||
routeKey: routeKey,
|
||||
}
|
||||
session.UpdateConnector(connector)
|
||||
replay := daResponsePattern.ReplaceAll(session.GetReplayBuffer(), nil)
|
||||
if len(replay) > 0 {
|
||||
s.enqueueWSFrame(routeKey, websocket.BinaryMessage, replay)
|
||||
|
||||
Reference in New Issue
Block a user