summaryrefslogtreecommitdiff
path: root/internal/clients/baseclient.go
diff options
context:
space:
mode:
authorPaul Buetow <pbuetow@mimecast.com>2020-09-10 14:57:52 +0100
committerPaul Buetow <pbuetow@mimecast.com>2020-09-10 14:57:52 +0100
commit1c7c0dbb5174b5255912183b9ec5870ccdef3426 (patch)
tree50a5e492ac42221178320fb06a16c34e1b0a4bba /internal/clients/baseclient.go
parent40cbef0c243042521bdf589b3c4549ff32508592 (diff)
printing client stats every other second only if the connection count has changed or when SIGUSR1 or SIGINFO recieved
Diffstat (limited to 'internal/clients/baseclient.go')
-rw-r--r--internal/clients/baseclient.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/clients/baseclient.go b/internal/clients/baseclient.go
index ba18f95..008a01e 100644
--- a/internal/clients/baseclient.go
+++ b/internal/clients/baseclient.go
@@ -66,11 +66,11 @@ func (c *baseClient) makeConnections(maker maker) {
c.stats = newTailStats(len(c.connections))
}
-func (c *baseClient) Start(ctx context.Context) (status int) {
+func (c *baseClient) Start(ctx context.Context, statsCh <-chan struct{}) (status int) {
// Periodically check for unknown hosts, and ask the user whether to trust them or not.
go c.hostKeyCallback.PromptAddHosts(ctx)
- // Periodically print out connection stats to the client.
- go c.stats.periodicLogStats(ctx, c.throttleCh)
+ // Print client stats every time something on statsCh is recieved.
+ go c.stats.Start(ctx, c.throttleCh, statsCh)
// Keep count of active connections
active := make(chan struct{}, len(c.connections))