1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-30 05:56:54 -05:00

simplify code

This commit is contained in:
Darien Raymond 2017-04-16 13:17:35 +02:00
parent 5c2cabb44e
commit d6988f1a63
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
5 changed files with 5 additions and 17 deletions

View File

@ -67,8 +67,5 @@ func (w *Writer) Close() {
frame := buf.New()
frame.AppendSupplier(meta.AsSupplier())
mb := buf.NewMultiBuffer()
mb.Append(frame)
w.writer.Write(mb)
w.writer.Write(buf.NewMultiBufferValue(frame))
}

View File

@ -28,9 +28,7 @@ func (v *NoneResponse) WriteTo(buf.Writer) {}
func (v *HTTPResponse) WriteTo(writer buf.Writer) {
b := buf.NewLocal(512)
b.AppendSupplier(serial.WriteString(http403response))
mb := buf.NewMultiBuffer()
mb.Append(b)
writer.Write(mb)
writer.Write(buf.NewMultiBufferValue(b))
}
// GetInternalResponse converts response settings from proto to internal data structure.

View File

@ -100,10 +100,7 @@ func (v *ChunkReader) Read() (buf.MultiBuffer, error) {
}
buffer.SliceFrom(AuthSize)
mb := buf.NewMultiBuffer()
mb.Append(buffer)
return mb, nil
return buf.NewMultiBufferValue(buffer), nil
}
type ChunkWriter struct {

View File

@ -374,9 +374,7 @@ func (v *UDPReader) Read() (buf.MultiBuffer, error) {
buffer.Release()
return nil, err
}
mb := buf.NewMultiBuffer()
mb.Append(payload)
return mb, nil
return buf.NewMultiBufferValue(payload), nil
}
type UDPWriter struct {

View File

@ -358,9 +358,7 @@ func (r *UDPReader) Read() (buf.MultiBuffer, error) {
}
b.Clear()
b.Append(data)
mb := buf.NewMultiBuffer()
mb.Append(b)
return mb, nil
return buf.NewMultiBufferValue(b), nil
}
type UDPWriter struct {