Fix bugs in packet.Packet.Pack()

This commit is contained in:
Tnze
2021-12-12 15:23:21 +08:00
parent 38cc60ea65
commit 4e7db1e122
3 changed files with 3 additions and 2 deletions

View File

@ -121,6 +121,7 @@ func (p *Packet) packWithCompression(w io.Writer, threshold int) error {
dataLength := bufPool.Get().(*bytes.Buffer)
defer bufPool.Put(dataLength)
dataLength.Reset()
n3, err := VarInt(int(n1) + n2).WriteTo(dataLength)
if err != nil {
return err