MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / CloseSession

Method CloseSession

internal/vnc/session_manager.go:498–525  ·  view source on GitHub ↗

CloseSession closes a specific session by ID.

(sessionID string)

Source from the content-addressed store, hash-verified

496
497// CloseSession closes a specific session by ID.
498func (sm *SessionManager) CloseSession(sessionID string) error {
499 sm.mutex.Lock()
500 defer sm.mutex.Unlock()
501
502 session, exists := sm.sessions[sessionID]
503 if !exists {
504 return fmt.Errorf("session not found: %s", sessionID)
505 }
506
507 if sm.logger != nil {
508 sm.logger.Info("Closing VNC session: session_id=%s, target_type=%s, target_name=%s",
509 sessionID, session.TargetType, session.TargetName)
510 }
511
512 // Shutdown the session
513 err := session.Shutdown()
514 if err != nil && sm.logger != nil {
515 sm.logger.Error("Failed to shutdown session: session_id=%s, error=%v", sessionID, err)
516 }
517
518 // Remove from sessions map
519 delete(sm.sessions, sessionID)
520
521 // Notify callback of session count change
522 sm.notifySessionCountChange()
523
524 return err
525}
526
527// CloseAllSessions closes all active sessions.
528func (sm *SessionManager) CloseAllSessions() error {

Callers

nothing calls this directly

Calls 4

InfoMethod · 0.65
ShutdownMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected