MCPcopy
hub / github.com/1Panel-dev/KubePi / Close

Method Close

pkg/terminal/shell.go:166–178  ·  view source on GitHub ↗

Close shuts down the SockJS connection and sends the status code and reason to the client Can happen if the process exits or if there is an error starting up the process For now the status code is unused and reason is shown to the user (unless "")

(sessionId string, status uint32, reason string)

Source from the content-addressed store, hash-verified

164// Can happen if the process exits or if there is an error starting up the process
165// For now the status code is unused and reason is shown to the user (unless "")
166func (sm *SessionMap) Close(sessionId string, status uint32, reason string) {
167 if _, ok := sm.Sessions[sessionId]; !ok {
168 return
169 }
170 sm.Lock.Lock()
171 defer sm.Lock.Unlock()
172 err := sm.Sessions[sessionId].sockJSSession.Close(status, reason)
173 if err != nil && status != 1 {
174 log.Println(err)
175 }
176
177 delete(sm.Sessions, sessionId)
178}
179
180// Clean all session when system logout
181func (sm *SessionMap) Clean() {

Callers

nothing calls this directly

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected