Closed atc0005 closed 3 years ago
Printed page 5 of 8:
The range will work until the channel is closed explicitly.
https://guzalexander.com/2013/12/06/golang-channels-tutorial.html
They're using a dedicated book done channel, returns zero value upon channel close. Will have to keep that bit in mind.
Closing the channel as the last DNS servers range iteration should be easier to manage?
Except if we close the channel, how will any slow goroutine respond on the results channel?
https://dave.cheney.net/2013/04/30/curious-channels
Using this property we can rewrite the program, now including 100 routines, without having to keep track of the number of goroutines spawned, or correctly size the finish channel.
sync.WaitGroup
, finish channel, close finish channel to trigger calling done.Done()
Resolved as part of #145.
Currently we are using a different approach to tell when all DNS server queries have completed. Closing the channel as the last DNS servers range iteration should be easier to manage?
Insert point looks like line 88:
https://github.com/atc0005/dnsc/blob/ef69f557d3730f3f8bad6229fdb1213bf2209c63/cmd/dnsc/main.go#L86-L90