mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 18:17:52 -05:00
reallocate in for loop
This commit is contained in:
parent
88b521c77e
commit
afcad409e2
@ -60,12 +60,12 @@ func (w *BufferedWriter) Write(b []byte) (int, error) {
|
|||||||
return w.legacyWriter.Write(b)
|
return w.legacyWriter.Write(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
if w.buffer == nil {
|
|
||||||
w.buffer = New()
|
|
||||||
}
|
|
||||||
|
|
||||||
totalBytes := 0
|
totalBytes := 0
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
|
if w.buffer == nil {
|
||||||
|
w.buffer = New()
|
||||||
|
}
|
||||||
|
|
||||||
nBytes, err := w.buffer.Write(b)
|
nBytes, err := w.buffer.Write(b)
|
||||||
totalBytes += nBytes
|
totalBytes += nBytes
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user