1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-25 05:16:09 -04:00

always allocate buffer in Write

This commit is contained in:
Darien Raymond 2017-11-16 18:34:05 +01:00
parent 51ddc00c70
commit 23b768576e
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -60,6 +60,10 @@ 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 {
nBytes, err := w.buffer.Write(b)