simplify logic

pull/2034/head
v2ray 2016-07-29 12:13:09 +02:00
parent 53cdcfdc2b
commit 6fa84624cb
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 2 additions and 4 deletions

View File

@ -77,15 +77,13 @@ func (this *Stream) Read() (*alloc.Buffer, error) {
}
func (this *Stream) Write(data *alloc.Buffer) error {
if this.closed {
return io.EOF
}
for {
for !this.closed {
err := this.TryWriteOnce(data)
if err != ErrIOTimeout {
return err
}
}
return io.EOF
}
func (this *Stream) TryWriteOnce(data *alloc.Buffer) error {