RemoveStats marks a peer as deleted but keeps counters until a reset reports them.
(publicKey string)
| 259 | |
| 260 | // RemoveStats marks a peer as deleted but keeps counters until a reset reports them. |
| 261 | func (st *Tracker) RemoveStats(publicKey string) { |
| 262 | st.mu.Lock() |
| 263 | defer st.mu.Unlock() |
| 264 | |
| 265 | entry, exists := st.stats[publicKey] |
| 266 | if !exists { |
| 267 | return |
| 268 | } |
| 269 | |
| 270 | // Persist pending deltas so re-add before stats pull won't lose data. |
| 271 | entry.LastDeltaRx = entry.CurrentRx - entry.BaseRx |
| 272 | entry.LastDeltaTx = entry.CurrentTx - entry.BaseTx |
| 273 | |
| 274 | // Mark deleted and clear active time so online checks return offline immediately. |
| 275 | entry.IsDeleted = true |
| 276 | entry.LastActiveTime = time.Time{} |
| 277 | } |
| 278 | |
| 279 | // ClearAllStats clears all stats |
| 280 | func (st *Tracker) ClearAllStats() { |
no outgoing calls