5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-09-20 04:52:33 +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])
buf = append(buf, bs)
totalLen := padLen + len(bs)
s.outputBuffer = buf[:0] // So we can reuse the same underlying array later
var bn int
for bn < totalLen {
n, err := buf.WriteTo(s.rwc)