MCPcopy
hub / github.com/grpc/grpc-go / dnsResolver

Struct dnsResolver

internal/resolver/dns/dns_resolver.go:170–189  ·  view source on GitHub ↗

dnsResolver watches for the name resolution update for a non-IP target.

Source from the content-addressed store, hash-verified

168
169// dnsResolver watches for the name resolution update for a non-IP target.
170type dnsResolver struct {
171 host string
172 port string
173 resolver internal.NetResolver
174 ctx context.Context
175 cancel context.CancelFunc
176 cc resolver.ClientConn
177 // rn channel is used by ResolveNow() to force an immediate resolution of the
178 // target.
179 rn chan struct{}
180 // wg is used to enforce Close() to return after the watcher() goroutine has
181 // finished. Otherwise, data race will be possible. [Race Example] in
182 // dns_resolver_test we replace the real lookup functions with mocked ones to
183 // facilitate testing. If Close() doesn't wait for watcher() goroutine
184 // finishes, race detector sometimes will warn lookup (READ the lookup
185 // function pointers) inside watcher() goroutine has data race with
186 // replaceNetFunc (WRITE the lookup function pointers).
187 wg sync.WaitGroup
188 enableServiceConfig bool
189}
190
191// ResolveNow invoke an immediate resolution of the target that this
192// dnsResolver watches.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected