net/dns: don't send on closed channel in resolvedManager

Fixes #7686

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: Ibffb05539ab876b12407d77dcf2201d467895981
pull/7690/head
Andrew Dunham 2 years ago
parent 6f9aed1656
commit 33b359642e

@ -117,8 +117,10 @@ func newResolvedManager(logf logger.Logf, interfaceName string) (*resolvedManage
} }
func (m *resolvedManager) SetDNS(config OSConfig) error { func (m *resolvedManager) SetDNS(config OSConfig) error {
// NOTE: don't close this channel, since it's possible that the SetDNS
// call will time out and return before the run loop answers, at which
// point it will send on the now-closed channel.
errc := make(chan error, 1) errc := make(chan error, 1)
defer close(errc)
select { select {
case <-m.ctx.Done(): case <-m.ctx.Done():

Loading…
Cancel
Save