Skip to content

Commit

Permalink
Filter duplicates from 'discover'
Browse files Browse the repository at this point in the history
  • Loading branch information
barnybug committed Apr 3, 2016
1 parent 87c4881 commit 383f77b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/cast/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,12 @@ func discoverCommand(c *cli.Context) {
defer cancel()
discover := discovery.NewService(ctx)
go func() {
found := map[string]bool{}
for client := range discover.Found() {
fmt.Printf("Found: %s:%d '%s' (%s)\n", client.IP(), client.Port(), client.Name(), client.Device())
if _, ok := found[client.Uuid()]; !ok {
fmt.Printf("Found: %s:%d '%s' (%s)\n", client.IP(), client.Port(), client.Name(), client.Device())
found[client.Uuid()] = true
}
}
}()
fmt.Printf("Running discovery for %s...\n", timeout)
Expand Down

0 comments on commit 383f77b

Please sign in to comment.