diff --git a/fileTransfer/manager.go b/fileTransfer/manager.go index c6058ed7e64cb86798158adfe97a9daba3743148..6c6aa0575f8fb3bac4b832008a8bdda31465bfb7 100644 --- a/fileTransfer/manager.go +++ b/fileTransfer/manager.go @@ -215,7 +215,7 @@ func NewManager(params Params, user FtE2e) (FileTransfer, error) { // StartProcesses starts the sending threads. Adheres to the xxdk.Service type. func (m *manager) StartProcesses() (stoppable.Stoppable, error) { // Construct stoppables - sendStoppable := stoppable.NewMulti(workerPoolStoppable) + multiStoppable := stoppable.NewMulti(fileTransferStoppable) batchBuilderStop := stoppable.NewSingle(batchBuilderThreadStoppable) // Start sending threads @@ -226,14 +226,12 @@ func (m *manager) StartProcesses() (stoppable.Stoppable, error) { // running this asynchronously could result in a race condition where // some worker threads are not added to senderPoolStop before that stoppable // is added to the multiStoppable. - m.startSendingWorkerPool(sendStoppable) + m.startSendingWorkerPool(multiStoppable) jww.INFO.Printf("STOPPING FT THREAD DEBUG: \nmultiStoppable running proc: %v\nmultistop: %v\n", - sendStoppable, sendStoppable.GetRunningProcesses()) + multiStoppable, multiStoppable.GetRunningProcesses()) // Create a multi stoppable - multiStoppable := stoppable.NewMulti(fileTransferStoppable) multiStoppable.Add(batchBuilderStop) - multiStoppable.Add(sendStoppable) jww.INFO.Printf("STOPPING FT THREAD DEBUG: \nmultiStoppable running proc: %v\nmultistop: %v\n", multiStoppable.GetRunningProcesses(), multiStoppable) diff --git a/stoppable/multi.go b/stoppable/multi.go index 3230844f94d4d95df40bac08edfa24ca0cb857f4..270f28a17209700bebb0e7ba77460e03a7755997 100644 --- a/stoppable/multi.go +++ b/stoppable/multi.go @@ -128,9 +128,9 @@ func (m *Multi) Close() error { // Attempt to stop each stoppable in its own goroutine for _, stoppable := range m.stoppables { wg.Add(1) - jww.INFO.Printf("FT DEBUG: stopping %s", stoppable.Name()) - go func(stoppable Stoppable) { - if stoppable.Close() != nil { + go func(s Stoppable) { + jww.INFO.Printf("FT DEBUG: stopping %s", s.Name()) + if s.Close() != nil { atomic.AddUint32(&numErrors, 1) } wg.Done()