From 4e27d9fc8b71598541ddb38cd55bfe2ccee8c9be Mon Sep 17 00:00:00 2001
From: joshemb <josh@elixxir.io>
Date: Wed, 28 Sep 2022 16:42:54 -0700
Subject: [PATCH] Add debug

---
 fileTransfer/send.go | 7 ++++++-
 stoppable/single.go  | 5 +++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/fileTransfer/send.go b/fileTransfer/send.go
index 9a4aa9ff1..a54f324c1 100644
--- a/fileTransfer/send.go
+++ b/fileTransfer/send.go
@@ -62,7 +62,9 @@ func (m *manager) startSendingWorkerPool(multiStop *stoppable.Multi) {
 
 	for i := 0; i < workerPoolThreads; i++ {
 		stop := stoppable.NewSingle(sendThreadStoppableName + strconv.Itoa(i))
-		go m.sendingThread(stop)
+		go func(single *stoppable.Single) {
+			m.sendingThread(single)
+		}(stop)
 		jww.INFO.Printf("Adding stoppable %s", stop.Name())
 		multiStop.Add(stop)
 	}
@@ -83,9 +85,12 @@ func (m *manager) sendingThread(stop *stoppable.Single) {
 			return
 		case healthy := <-healthChan:
 			for !healthy {
+				jww.INFO.Printf("not healthy, waiting for health update")
 				healthy = <-healthChan
+				jww.INFO.Printf("received health update, it is now set to %s", healthy)
 			}
 		case packet := <-m.sendQueue:
+			jww.INFO.Printf("sending packet")
 			m.sendCmix(packet)
 		}
 	}
diff --git a/stoppable/single.go b/stoppable/single.go
index 02359ac45..b2313a3fc 100644
--- a/stoppable/single.go
+++ b/stoppable/single.go
@@ -90,6 +90,7 @@ func (s *Single) ToStopped() {
 // Quit returns a receive-only channel that will be triggered when the Stoppable
 // quits.
 func (s *Single) Quit() <-chan struct{} {
+	jww.INFO.Printf("Quit for %s", s.name)
 	return s.quit
 }
 
@@ -110,6 +111,10 @@ func (s *Single) Close() error {
 
 		// Send on quit channel
 		s.quit <- struct{}{}
+
+		jww.INFO.Printf("Sent to quit channel for single stoppable %q.",
+			s.Name())
+
 	})
 
 	if err != nil {
-- 
GitLab