Update buffer usage

This commit is contained in:
世界
2022-09-21 17:05:13 +08:00
parent a006627795
commit 693ef293ac
4 changed files with 4 additions and 14 deletions

View File

@@ -466,10 +466,7 @@ func (c *ClientPacketAddrConn) ReadPacket(buffer *buf.Buffer) (destination M.Soc
if err != nil {
return
}
if buffer.FreeLen() < int(length) {
return destination, io.ErrShortBuffer
}
_, err = io.ReadFull(c.ExtendedConn, buffer.Extend(int(length)))
_, err = buffer.ReadFullFrom(c.ExtendedConn, int(length))
return
}