mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-03 07:56:42 -05:00
simplify writing
This commit is contained in:
parent
3df32aabbc
commit
0b388280ce
@ -140,17 +140,9 @@ func (w *BufferedWriter) Flush() error {
|
||||
w.buffer = nil
|
||||
|
||||
if writer, ok := w.writer.(io.Writer); ok {
|
||||
defer b.Release()
|
||||
|
||||
for !b.IsEmpty() {
|
||||
n, err := writer.Write(b.Bytes())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.Advance(int32(n))
|
||||
}
|
||||
|
||||
return nil
|
||||
err := WriteAllBytes(writer, b.Bytes())
|
||||
b.Release()
|
||||
return err
|
||||
}
|
||||
|
||||
return w.writer.WriteMultiBuffer(NewMultiBufferValue(b))
|
||||
|
Loading…
Reference in New Issue
Block a user