瀏覽代碼

simplify logic

v2ray 9 年之前
父節點
當前提交
6fa84624cb
共有 1 個文件被更改,包括 2 次插入4 次删除
  1. 2 4
      transport/ray/direct.go

+ 2 - 4
transport/ray/direct.go

@@ -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 {