other: gateway 优化代码逻辑,适配 client.Client 变更

This commit is contained in:
kercylan98 2023-09-19 12:41:45 +08:00
parent 3ad1330cd9
commit 0cc8fd8186
1 changed files with 2 additions and 4 deletions

View File

@ -128,12 +128,10 @@ func (slf *Endpoint) Forward(conn *server.Conn, packet []byte, callback ...func(
}
var superior *client.Client
var superiorCount = -1
for _, cli := range slf.client {
count := cli.GetMessageAccumulationTotal()
if superiorCount < 0 || superiorCount > count {
if cli.IsConnected() {
superior = cli
superiorCount = count
break
}
}