diff --git a/connect/comms.go b/connect/comms.go index 06ec019dc2eeba684a6c8c2ae040795a16c290c1..352426fe6294aa14cef034cb7dad0d064ddc6864 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 0de9c72b728fcc30400a68e486544ab03429f302..66b2dead5f3562d5ef09d5cb2f50957f4a9e5731 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