taildrop: fix defer in loop (#13757)

However, this affects the scope of a defer.

Updates #11038

Signed-off-by: Joe Tsai <joetsai@digital-static.net>
pull/13763/head
Joe Tsai 1 month ago committed by GitHub
parent 5b7303817e
commit 52ef27ab7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -228,7 +228,6 @@ func (m *Manager) IncomingFiles() []ipn.PartialFile {
files := make([]ipn.PartialFile, 0) files := make([]ipn.PartialFile, 0)
for k, f := range m.incomingFiles.All() { for k, f := range m.incomingFiles.All() {
f.mu.Lock() f.mu.Lock()
defer f.mu.Unlock()
files = append(files, ipn.PartialFile{ files = append(files, ipn.PartialFile{
Name: k.name, Name: k.name,
Started: f.started, Started: f.started,
@ -238,6 +237,7 @@ func (m *Manager) IncomingFiles() []ipn.PartialFile {
FinalPath: f.finalPath, FinalPath: f.finalPath,
Done: f.done, Done: f.done,
}) })
f.mu.Unlock()
} }
return files return files
} }

Loading…
Cancel
Save