From 0cbfa7b0ca317f7af7c0a526ad84020662b7f252 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Tue, 25 Jan 2022 22:04:57 +0100 Subject: [PATCH] Write out disk writer packets unconditionally. If the stream was very short, we may not have created a writer yet. Write out packets even in that case. --- diskwriter/diskwriter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diskwriter/diskwriter.go b/diskwriter/diskwriter.go index 9b599dd..1ea5c37 100644 --- a/diskwriter/diskwriter.go +++ b/diskwriter/diskwriter.go @@ -184,8 +184,8 @@ func (conn *diskConn) warn(message string) { // called locked func (conn *diskConn) reopen(extension string) error { for _, t := range conn.tracks { + t.writeBuffered(true) if t.writer != nil { - t.writeBuffered(true) t.writer.Close() t.writer = nil } @@ -207,8 +207,8 @@ func (conn *diskConn) Close() error { conn.mu.Lock() tracks := make([]*diskTrack, 0, len(conn.tracks)) for _, t := range conn.tracks { + t.writeBuffered(true) if t.writer != nil { - t.writeBuffered(true) t.writer.Close() t.writer = nil }