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)
| 1146 | // |
| 1147 | //nolint:revive |
| 1148 | func (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. |
no test coverage detected