From 52ef27ab7c3078513ea7e265ce4a1b3e0adea833 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Wed, 9 Oct 2024 14:09:58 -0700 Subject: [PATCH] taildrop: fix defer in loop (#13757) However, this affects the scope of a defer. Updates #11038 Signed-off-by: Joe Tsai --- taildrop/taildrop.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taildrop/taildrop.go b/taildrop/taildrop.go index e425027c5..4d14787af 100644 --- a/taildrop/taildrop.go +++ b/taildrop/taildrop.go @@ -228,7 +228,6 @@ func (m *Manager) IncomingFiles() []ipn.PartialFile { files := make([]ipn.PartialFile, 0) for k, f := range m.incomingFiles.All() { f.mu.Lock() - defer f.mu.Unlock() files = append(files, ipn.PartialFile{ Name: k.name, Started: f.started, @@ -238,6 +237,7 @@ func (m *Manager) IncomingFiles() []ipn.PartialFile { FinalPath: f.finalPath, Done: f.done, }) + f.mu.Unlock() } return files }