mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 01:57:12 -05:00
refactor
This commit is contained in:
parent
cee2fe4b6f
commit
6361ea3188
@ -40,8 +40,7 @@ func (v *BufferedReader) Read(b []byte) (int, error) {
|
||||
return v.reader.Read(b)
|
||||
}
|
||||
if v.buffer.IsEmpty() {
|
||||
err := v.buffer.AppendSupplier(ReadFrom(v.reader))
|
||||
if err != nil {
|
||||
if err := v.buffer.Reset(ReadFrom(v.reader)); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,7 @@ func (v *BufferedWriter) Write(b []byte) (int, error) {
|
||||
return 0, err
|
||||
}
|
||||
if v.buffer.IsFull() {
|
||||
err := v.Flush()
|
||||
if err != nil {
|
||||
if err := v.Flush(); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if nBytes < len(b) {
|
||||
|
Loading…
Reference in New Issue
Block a user