mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-07-26 11:44:22 -04:00
simplify logic
This commit is contained in:
parent
53cdcfdc2b
commit
6fa84624cb
@ -77,15 +77,13 @@ func (this *Stream) Read() (*alloc.Buffer, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *Stream) Write(data *alloc.Buffer) error {
|
func (this *Stream) Write(data *alloc.Buffer) error {
|
||||||
if this.closed {
|
for !this.closed {
|
||||||
return io.EOF
|
|
||||||
}
|
|
||||||
for {
|
|
||||||
err := this.TryWriteOnce(data)
|
err := this.TryWriteOnce(data)
|
||||||
if err != ErrIOTimeout {
|
if err != ErrIOTimeout {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return io.EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Stream) TryWriteOnce(data *alloc.Buffer) error {
|
func (this *Stream) TryWriteOnce(data *alloc.Buffer) error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user