Skip to content

Commit

Permalink
wip: Shut down after pump is done
Browse files Browse the repository at this point in the history
  • Loading branch information
shazow committed Dec 9, 2019
1 parent 1cc7f41 commit 4ef82e7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,22 @@ func main() {
logger.Info().Int("clients", len(clients)).Msg("started endpoint clients, pumping stdin")

g.Go(func() error {
defer abort()
return pump(ctx, os.Stdin, clients)
})

if err := g.Wait(); err != nil {
if err := g.Wait(); err == context.Canceled {
// Shutting down
} else if err != nil {
exit(3, "failed: %s", err)
}

// TODO: Make a report
for _, client := range clients {
fmt.Println(client.Stats)
for i, client := range clients {
fmt.Printf("endpoint[%d]: %+v\n", i, client.Stats)
}

fmt.Println(r)
fmt.Printf("report: %+v\n", r)
}

// pump takes lines from a reader and pumps them into the clients
Expand Down

0 comments on commit 4ef82e7

Please sign in to comment.