1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00

avoid writing empty payload in bytesToBufferWriter

This commit is contained in:
Darien Raymond 2017-11-08 23:43:16 +01:00
parent cf080e8061
commit 3d2fd372e1
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -90,11 +90,10 @@ func (w *bytesToBufferWriter) WriteMultiBuffer(mb MultiBuffer) error {
func (w *bytesToBufferWriter) ReadFrom(reader io.Reader) (int64, error) {
mbReader := NewReader(reader)
totalBytes := int64(0)
eof := false
for !eof {
for {
mb, err := mbReader.Read()
if err == io.EOF {
eof = true
if errors.Cause(err) == io.EOF {
break
} else if err != nil {
return totalBytes, err
}