From 3df7634570111f135502a476f7e2ab3115944e64 Mon Sep 17 00:00:00 2001 From: v2ray Date: Sun, 1 May 2016 17:19:09 +0200 Subject: [PATCH] safer for loop --- common/log/log_writer.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/log/log_writer.go b/common/log/log_writer.go index fe7aa152..ab955594 100644 --- a/common/log/log_writer.go +++ b/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 } }