1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-26 12:07:47 -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 := buf.New()
frame.AppendSupplier(meta.AsSupplier()) frame.AppendSupplier(meta.AsSupplier())
mb := buf.NewMultiBuffer() w.writer.Write(buf.NewMultiBufferValue(frame))
mb.Append(frame)
w.writer.Write(mb)
} }

View File

@ -28,9 +28,7 @@ func (v *NoneResponse) WriteTo(buf.Writer) {}
func (v *HTTPResponse) WriteTo(writer buf.Writer) { func (v *HTTPResponse) WriteTo(writer buf.Writer) {
b := buf.NewLocal(512) b := buf.NewLocal(512)
b.AppendSupplier(serial.WriteString(http403response)) b.AppendSupplier(serial.WriteString(http403response))
mb := buf.NewMultiBuffer() writer.Write(buf.NewMultiBufferValue(b))
mb.Append(b)
writer.Write(mb)
} }
// GetInternalResponse converts response settings from proto to internal data structure. // 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) buffer.SliceFrom(AuthSize)
mb := buf.NewMultiBuffer() return buf.NewMultiBufferValue(buffer), nil
mb.Append(buffer)
return mb, nil
} }
type ChunkWriter struct { type ChunkWriter struct {

View File

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

View File

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