From 8ec1d521f8375be82563b491f67fdf908c25b5d8 Mon Sep 17 00:00:00 2001 From: Ash Logan Date: Thu, 2 Jan 2025 22:17:15 +1100 Subject: [PATCH] feat(debug): fix big bug era --- main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 07f4107..73003a1 100644 --- a/main.go +++ b/main.go @@ -25,7 +25,7 @@ func main() { func selfTest() { globals.Logger.Info("Self-testing...") var errors = 0 - var seenPids map[uint64]struct{} + seenPids := make(map[uint64]struct{}) // apparently we hold a lock all the way thru this globals.SecureEndpoint.Connections.Each(func(key string, pc *nex2.PRUDPConnection) bool { if pc.PID() == nil || pc.PID().Value() == 0 { @@ -51,7 +51,7 @@ func selfTest() { var found = false globals.SecureServer.Connections.Each(func(key string, sc *nex2.SocketConnection) bool { return sc.Connections.Each(func(key uint8, pc2 *nex2.PRUDPConnection) bool { - if pc2 == pc { + if pc2.ID == pc.ID { if found { globals.Logger.Warningf("Duplicate SocketConnection: %v %#v", key, pc) errors++ @@ -68,7 +68,7 @@ func selfTest() { } return false }) - globals.Logger.Infof("Self-test finished with %v errors", errors) + globals.Logger.Infof("Self-test finished with %v errors - %v connections", errors, globals.SecureEndpoint.Connections.Size()) } func startSelfTesting() { for range time.Tick(10 * time.Second) {