From c47b4f828f6f4facff45528d7b137fff94fad1e4 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sun, 24 Jan 2016 11:20:55 +0000 Subject: [PATCH] acd: Fix deadlock in directory traversal code --- amazonclouddrive/amazonclouddrive.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/amazonclouddrive/amazonclouddrive.go b/amazonclouddrive/amazonclouddrive.go index d593f8695..934098502 100644 --- a/amazonclouddrive/amazonclouddrive.go +++ b/amazonclouddrive/amazonclouddrive.go @@ -420,11 +420,14 @@ func (f *Fs) listDirNonRecursive(dirID string, path string, out fs.ObjectsChan) errs <- err } // FIXME stop traversal on error? - // Now we have traversed this directory, send these jobs off for traversal - for _, job := range jobs { - traversing.Add(1) - in <- job - } + traversing.Add(len(jobs)) + go func() { + // Now we have traversed this directory, send these jobs off for traversal in + // the background + for _, job := range jobs { + in <- job + } + }() traversing.Done() } }()