OnAgentClosed is called when the agent sends rdp_proxy_closed. Two cases: - Handshake never completed: the signal unblocks ServeCreateTicket with a failure. The "Agent closed..." text is only ever surfaced here. - Handshake already completed: readyOnce drops the failure signal (the stored result sta
(apiID string, sessionID string)
| 374 | // stored result stays Connected=true); cleanup still runs to close the |
| 375 | // TCP bridge. This is the normal end-of-session path. |
| 376 | func (s *Sessions) OnAgentClosed(apiID string, sessionID string) { |
| 377 | s.mu.RLock() |
| 378 | sess, ok := s.sessions[sessionID] |
| 379 | s.mu.RUnlock() |
| 380 | if !ok || sess.ApiID != apiID { |
| 381 | return |
| 382 | } |
| 383 | sess.signalAgentReady(AgentResult{Connected: false, ErrorMsg: "Agent closed the RDP proxy connection"}) |
| 384 | sess.cleanup() |
| 385 | } |
| 386 | |
| 387 | // WaitAgentReady waits for the initial handshake on the named session. |
| 388 | func (s *Sessions) WaitAgentReady(ctx context.Context, sessionID string, timeout time.Duration) (AgentResult, error) { |
no test coverage detected