diff --git a/fileTransfer/manager.go b/fileTransfer/manager.go index 55fbd90e09f7c34c4a935d8bc3beb5364de8873c..ba5ca3e254af289f1098083072a8079ff76b6d6e 100644 --- a/fileTransfer/manager.go +++ b/fileTransfer/manager.go @@ -215,20 +215,25 @@ 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 - multiStoppable := stoppable.NewMulti(fileTransferStoppable) + sendStoppable := stoppable.NewMulti(sendThreadStoppableName) batchBuilderStop := stoppable.NewSingle(batchBuilderThreadStoppable) // Start sending threads + go m.batchBuilderThread(batchBuilderStop) + // Note that the startSendingWorkerPool already creates thread for every // worker. As a result, there is no need to run it asynchronously. In fact, // 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(multiStoppable) - go m.batchBuilderThread(batchBuilderStop) + m.startSendingWorkerPool(sendStoppable) + jww.INFO.Printf("STOPPING FT THREAD DEBUG: \nmultiStoppable running proc: %v\nmultistop: %v\n", + sendStoppable, sendStoppable.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/single.go b/stoppable/single.go index 35013bb0b0713be98e94729c297a1b34c9d54288..02359ac451a3d8635589fb43f5fc179d4aea2349 100644 --- a/stoppable/single.go +++ b/stoppable/single.go @@ -105,7 +105,7 @@ func (s *Single) Close() error { return } - jww.TRACE.Printf("Sending on quit channel to single stoppable %q.", + jww.INFO.Printf("Sending on quit channel to single stoppable %q.", s.Name()) // Send on quit channel