Archived
1
0

don't do a short write

This commit is contained in:
Jeff Becker 2017-04-04 11:04:14 -04:00
parent a66d31f447
commit 28a30bdd3d

View File

@ -22,9 +22,13 @@ func (l *LineWriter) Write(data []byte) (n int, err error) {
err = ErrOversizedMessage err = ErrOversizedMessage
return return
} }
wr := len(data)
data = bytes.Replace(data, []byte{13, 10}, []byte{10}, -1) data = bytes.Replace(data, []byte{13, 10}, []byte{10}, -1)
n, err = l.w.Write(data) n, err = l.w.Write(data)
l.Left -= int64(n) l.Left -= int64(n)
if err != nil {
return n, err
}
n = wr
return return
} }