Hi,
I am using a long lived resolver which sometimes generates "write on closed channel" panics.
The fix below just copies the pattern from the stopProbing channel:
diff --git a/service.go b/service.go
index 6253c54..42ab5bd 100644
--- a/service.go
+++ b/service.go
@@ -72,7 +72,8 @@ type lookupParams struct {
isBrowsing bool
stopProbing chan struct{}
- noMore sync.Once
- stop sync.Once
}
// newLookupParams constructs a lookupParams.
@@ -91,11 +92,11 @@ func newLookupParams(instance, service, domain string, isBrowsing bool, entries
// Notify subscriber that no more entries will arrive. Mostly caused
// by an expired context.
func (l *lookupParams) done() {
- l.noMore.Do(func() { close(l.Entries) })
}
func (l *lookupParams) disableProbing() {
- l.once.Do(func() { close(l.stopProbing) })
- l.stop.Do(func() { close(l.stopProbing) })
}
// ServiceEntry represents a browse/lookup result for client API.
Hi,
I am using a long lived resolver which sometimes generates "write on closed channel" panics.
The fix below just copies the pattern from the stopProbing channel:
diff --git a/service.go b/service.go
index 6253c54..42ab5bd 100644
--- a/service.go
+++ b/service.go
@@ -72,7 +72,8 @@ type lookupParams struct {
}
// newLookupParams constructs a lookupParams.
@@ -91,11 +92,11 @@ func newLookupParams(instance, service, domain string, isBrowsing bool, entries
// Notify subscriber that no more entries will arrive. Mostly caused
// by an expired context.
func (l *lookupParams) done() {
}
func (l *lookupParams) disableProbing() {
}
// ServiceEntry represents a browse/lookup result for client API.