@@ -86,6 +86,7 @@ func (r *Resolver) Browse(ctx context.Context, service, domain string, entries c
8686 params .Domain = domain
8787 }
8888 params .Entries = entries
89+ params .isBrowsing = true
8990 ctx , cancel := context .WithCancel (ctx )
9091 go r .c .mainloop (ctx , params )
9192
@@ -134,7 +135,7 @@ func (r *Resolver) Lookup(ctx context.Context, instance, service, domain string,
134135
135136// defaultParams returns a default set of QueryParams.
136137func defaultParams (service string ) * lookupParams {
137- return newLookupParams ("" , service , "local" , make (chan * ServiceEntry ))
138+ return newLookupParams ("" , service , "local" , false , make (chan * ServiceEntry ))
138139}
139140
140141// Client structure encapsulates both IPv4/IPv6 UDP connections.
@@ -293,7 +294,9 @@ func (c *client) mainloop(ctx context.Context, params *lookupParams) {
293294 // service entry.
294295 params .Entries <- e
295296 sentEntries [k ] = e
296- params .disableProbing ()
297+ if ! params .isBrowsing {
298+ params .disableProbing ()
299+ }
297300 }
298301 // reset entries
299302 entries = make (map [string ]* ServiceEntry )
@@ -368,10 +371,6 @@ func (c *client) recv(ctx context.Context, l interface{}, msgCh chan *dns.Msg) {
368371// TODO: move error reporting to shutdown function as periodicQuery is called from
369372// go routine context.
370373func (c * client ) periodicQuery (ctx context.Context , params * lookupParams ) error {
371- if params .stopProbing == nil {
372- return nil
373- }
374-
375374 bo := backoff .NewExponentialBackOff ()
376375 bo .InitialInterval = 4 * time .Second
377376 bo .MaxInterval = 60 * time .Second
0 commit comments