SetPoisonActive sets the poison-active state for a session. When taskID > 0, a poison cycle is active; 0 clears the poison state.
(sessionID string, active bool, taskID uint32)
| 214 | // SetPoisonActive sets the poison-active state for a session. |
| 215 | // When taskID > 0, a poison cycle is active; 0 clears the poison state. |
| 216 | func (m *Manager) SetPoisonActive(sessionID string, active bool, taskID uint32) { |
| 217 | sess := m.Get(sessionID) |
| 218 | if sess == nil { |
| 219 | return |
| 220 | } |
| 221 | sess.mu.Lock() |
| 222 | defer sess.mu.Unlock() |
| 223 | if active { |
| 224 | sess.poisonTaskID = taskID |
| 225 | } else { |
| 226 | sess.poisonTaskID = 0 |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | // IsPoisonActive reports whether the session has an active poison cycle. |
| 231 | func (m *Manager) IsPoisonActive(sessionID string) bool { |