1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-06-21 02:09:55 -04:00

reallocate in for loop

This commit is contained in:
Darien Raymond
2017-11-17 09:18:12 +00:00
parent 88b521c77e
commit afcad409e2

View File

@@ -60,12 +60,12 @@ func (w *BufferedWriter) Write(b []byte) (int, error) {
return w.legacyWriter.Write(b)
}
if w.buffer == nil {
w.buffer = New()
}
totalBytes := 0
for len(b) > 0 {
if w.buffer == nil {
w.buffer = New()
}
nBytes, err := w.buffer.Write(b)
totalBytes += nBytes
if err != nil {