소스 검색

safer for loop

v2ray 9 년 전
부모
커밋
3df7634570
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      common/log/log_writer.go

+ 3 - 1
common/log/log_writer.go

@@ -54,9 +54,11 @@ func (this *fileLogWriter) Log(log LogEntry) {
 }
 
 func (this *fileLogWriter) run() {
-	for entry := range this.queue {
+	for {
+		entry := <-this.queue
 		this.logger.Print(entry.String() + platform.LineSeparator())
 		entry.Release()
+		entry = nil
 	}
 }