support kicker status

This commit is contained in:
adman
2026-04-17 21:51:47 +02:00
parent acc583f694
commit 7a2081f0a0
2 changed files with 13 additions and 15 deletions
+3 -14
View File
@@ -37,11 +37,7 @@ func ServeClient(cNet net.Conn, factory Factory) {
return
}
if err != nil {
c.Log.Error("Error while handling client", "error", err, "client", c.Conn.RemoteAddr())
err = Kick(c, text.Pretty(err.Error()))
if err != nil {
c.Log.Error("Error while kicking client", "error", err, "client", c.Conn.RemoteAddr())
}
}
}
@@ -79,19 +75,12 @@ func StartServerWithOnConn(listenAddr string, onConn func(c *proto.Conn) (err er
c := Servee(cNet)
defer c.Close()
connErr := onConn(c)
if connErr != nil {
if c.State() == proto_base.Status || c.State() == proto_base.Handshaking {
return // we dont care about status packets
}
c.Log.Error("Error while handling client", "error", connErr, "client", c.Conn.RemoteAddr())
connErr = Kick(c, text.Pretty(connErr.Error()))
if connErr != nil {
c.Log.Error("Error while kicking client", "error", connErr, "client", c.Conn.RemoteAddr())
}
}
if errors.Is(connErr, ShutDownServerErr) {
running = false
}
if connErr != nil {
connErr = Kick(c, text.Pretty(connErr.Error()))
}
}()
}
err = ShutDownServerErr