Change conn.ReadPacket for reuse of the buffer

This commit is contained in:
Tnze
2021-02-25 14:24:28 +08:00
parent 5feb25895e
commit 27a30efe7b
8 changed files with 48 additions and 58 deletions

View File

@ -10,8 +10,9 @@ import (
)
func acceptListPing(conn net.Conn) {
var p pk.Packet
for i := 0; i < 2; i++ { // ping or list. Only accept twice
p, err := conn.ReadPacket()
err := conn.ReadPacket(&p)
if err != nil {
return
}