From 3d6200dc641659010b4bcc00c6200259ea34a656 Mon Sep 17 00:00:00 2001 From: v2ray Date: Sun, 22 May 2016 19:41:48 +0200 Subject: [PATCH] Fix another dead lock in buffered writer --- common/io/buffered_writer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/io/buffered_writer.go b/common/io/buffered_writer.go index a64e12d01..75712c250 100644 --- a/common/io/buffered_writer.go +++ b/common/io/buffered_writer.go @@ -70,10 +70,11 @@ func (this *BufferedWriter) SetCached(cached bool) { } func (this *BufferedWriter) Release() { + this.Flush() + this.Lock() defer this.Unlock() - this.Flush() this.buffer.Release() this.buffer = nil this.writer = nil