MCPcopy Index your code
hub / github.com/coder/coder / trackSession

Method trackSession

agent/agentssh/agentssh.go:1148–1163  ·  view source on GitHub ↗

trackSession registers the session with the server. If the server is closing, the session is not registered and should be closed. nolint:revive

(ss ssh.Session, add bool)

Source from the content-addressed store, hash-verified

1146//
1147//nolint:revive
1148func (s *Server) trackSession(ss ssh.Session, add bool) (ok bool) {
1149 s.mu.Lock()
1150 defer s.mu.Unlock()
1151 if add {
1152 if s.closing != nil {
1153 // Server closed.
1154 return false
1155 }
1156 s.wg.Add(1)
1157 s.sessions[ss] = struct{}{}
1158 return true
1159 }
1160 s.wg.Done()
1161 delete(s.sessions, ss)
1162 return true
1163}
1164
1165// trackCommand registers the process with the server. If the server is
1166// closing, the process is not registered and should be closed.

Callers 1

sessionHandlerMethod · 0.95

Calls 4

AddMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45
DoneMethod · 0.45

Tested by

no test coverage detected