From c72cbe8f27ae1f4f60478be588a9abc8395b9f85 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Thu, 4 Feb 2021 22:01:41 +0100 Subject: [PATCH] Don't attempt to replace empty connection in disk writer. --- diskwriter/diskwriter.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/diskwriter/diskwriter.go b/diskwriter/diskwriter.go index cda9419..50cf091 100644 --- a/diskwriter/diskwriter.go +++ b/diskwriter/diskwriter.go @@ -105,12 +105,14 @@ func (client *Client) PushConn(g *group.Group, id string, up conn.Up, tracks []c return errors.New("disk client is closed") } - rp := client.down[replace] - if rp != nil { - rp.Close() - delete(client.down, replace) - } else { - log.Printf("Replacing unknown connection") + if replace != "" { + rp := client.down[replace] + if rp != nil { + rp.Close() + delete(client.down, replace) + } else { + log.Printf("Disk writer: replacing unknown connection") + } } old := client.down[id]