support kicker status
This commit is contained in:
+3
-14
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user