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:
parent
5c2cabb44e
commit
d6988f1a63
@ -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))
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user