5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-12-23 16:55:40 +00:00

minor allocation fix

This commit is contained in:
Arceliar 2019-08-06 20:51:38 -05:00
parent 6cb0ed91ad
commit d795ab1b65

View File

@ -44,6 +44,7 @@ func (s *stream) writeMsg(bs []byte) (int, error) {
padLen := len(buf[0]) + len(buf[1]) padLen := len(buf[0]) + len(buf[1])
buf = append(buf, bs) buf = append(buf, bs)
totalLen := padLen + len(bs) totalLen := padLen + len(bs)
s.outputBuffer = buf[:0] // So we can reuse the same underlying array later
var bn int var bn int
for bn < totalLen { for bn < totalLen {
n, err := buf.WriteTo(s.rwc) n, err := buf.WriteTo(s.rwc)