From d5f4fd71033c285c781cdbf5efa69144ea104296 Mon Sep 17 00:00:00 2001
From: Jake Taylor <jake@elixxir.io>
Date: Thu, 17 Jun 2021 13:33:21 -0500
Subject: [PATCH] added manager print on timer

---
 connect/comms.go   | 11 -----------
 connect/manager.go | 14 ++++++++++++++
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/connect/comms.go b/connect/comms.go
index 06ec019..352426f 100644
--- a/connect/comms.go
+++ b/connect/comms.go
@@ -170,17 +170,6 @@ listen:
 			grpc.KeepaliveEnforcementPolicy(KaEnforcement))
 	}
 
-	// Intermittantly print manager connection information
-	go func() {
-		ticker := time.NewTicker(60 * time.Second)
-		for {
-			select {
-			case _ = <-ticker.C:
-				jww.INFO.Printf(pc.Manager.String())
-			}
-		}
-	}()
-
 	return pc, lis, nil
 }
 
diff --git a/connect/manager.go b/connect/manager.go
index 0de9c72..66b2dea 100644
--- a/connect/manager.go
+++ b/connect/manager.go
@@ -16,6 +16,7 @@ import (
 	"gitlab.com/xx_network/primitives/id"
 	"sync"
 	"testing"
+	"time"
 )
 
 // The Manager object provides thread-safe access
@@ -103,6 +104,19 @@ func (m *Manager) DisconnectAll() {
 	}
 }
 
+// StartConnectionReport begins intermittently printing connection information
+func (m *Manager) StartConnectionReport() {
+	go func() {
+		ticker := time.NewTicker(60 * time.Second)
+		for {
+			select {
+			case _ = <-ticker.C:
+				jww.INFO.Printf(m.String())
+			}
+		}
+	}()
+}
+
 // Implements Stringer for debug printing
 func (m *Manager) String() string {
 	var result bytes.Buffer
-- 
GitLab