aboutsummaryrefslogtreecommitdiff
path: root/backend/admin.go
diff options
context:
space:
mode:
authorWilliam Hergès <william@herges.fr>2025-12-30 18:59:30 +0100
committerWilliam Hergès <william@herges.fr>2025-12-30 18:59:30 +0100
commit1c4ec0e4fe4a765dad1db9ab332ebfdcc8c2b11e (patch)
treecced72df8b1db7827ce2fa28361fb18130e1304f /backend/admin.go
parent87b27187b93912fc22e61fd298606af7d7bce710 (diff)
feat(storage): scope stats per ip instead of target
Diffstat (limited to 'backend/admin.go')
-rw-r--r--backend/admin.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/backend/admin.go b/backend/admin.go
index 84b5c0f..b5cd695 100644
--- a/backend/admin.go
+++ b/backend/admin.go
@@ -5,7 +5,6 @@ import (
"math"
"net/http"
"strconv"
- "strings"
"sync"
"time"
@@ -34,9 +33,7 @@ type tos struct {
var timeouts = tos{tos: make(map[string]*to)}
func handleTimeout(ctx context.Context) bool {
- ip := ctx.Value(ipAdressKey).(string)
- parsed := strings.Split(ip, ":")
- ip = parsed[0]
+ ip := ctx.Value(storage.IPAddressKey).(string)
timeouts.mu.Lock()
defer timeouts.mu.Unlock()
@@ -69,12 +66,11 @@ func handleTimeout(ctx context.Context) bool {
}
func resetTimeout(ctx context.Context) {
- ip := ctx.Value(ipAdressKey).(string)
- parsed := strings.Split(ip, ":")
- ip = parsed[0]
+ ip := ctx.Value(storage.IPAddressKey).(string)
timeouts.mu.Lock()
defer timeouts.mu.Unlock()
+
delete(timeouts.tos, ip)
}