From 1c4ec0e4fe4a765dad1db9ab332ebfdcc8c2b11e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Tue, 30 Dec 2025 18:59:30 +0100 Subject: feat(storage): scope stats per ip instead of target --- backend/admin.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'backend/admin.go') 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) } -- cgit v1.2.3