MCPcopy Create free account
hub / github.com/PasarGuard/node / RemoveStats

Method RemoveStats

pkg/stats/tracker.go:261–277  ·  view source on GitHub ↗

RemoveStats marks a peer as deleted but keeps counters until a reset reports them.

(publicKey string)

Source from the content-addressed store, hash-verified

259
260// RemoveStats marks a peer as deleted but keeps counters until a reset reports them.
261func (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
280func (st *Tracker) ClearAllStats() {

Calls

no outgoing calls