fix: multiple bugfixes

- Fix data race: use atomic.Bool for running in server.go
- Fix busy loop in timer.go: use time.After when idle
- Fix division by zero in print_replay
- Fix silently swallowed errors in proto_generator
- Fix suppressed error in native_encoder
- Delete unused registry_data_hunter
This commit is contained in:
OpenCode
2026-08-05 14:50:10 +02:00
parent 0ed96837bd
commit 4b278b7ee3
7 changed files with 30 additions and 169 deletions
+5 -3
View File
@@ -3,6 +3,7 @@ package server
import (
"errors"
"net"
"sync/atomic"
"github.com/admin-else/strom/mc/proto"
"github.com/admin-else/strom/mc/proto_base"
@@ -68,8 +69,9 @@ func StartServerWithOnConn(listenAddr string, onConn func(c *proto.Conn) (err er
return
}
defer l.Close()
running := true
for running {
running := atomic.Bool{}
running.Store(true)
for running.Load() {
var cNet net.Conn
cNet, err = l.Accept()
if err != nil {
@@ -80,7 +82,7 @@ func StartServerWithOnConn(listenAddr string, onConn func(c *proto.Conn) (err er
defer c.Close()
connErr := onConn(c)
if errors.Is(connErr, ShutDownServerErr) {
running = false
running.Store(false)
}
c.Log.Error("closing connection", "err", connErr)
if connErr != nil {