Pull request: all: fix race, imp scripts
Merge in DNS/adguard-home from fix-race to master Squashed commit of the following: commit dff47c707554f689cf131e0ab3fe05df4e4b6a51 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri May 21 19:12:06 2021 +0300 all: fix race, imp scripts
This commit is contained in:
@@ -121,7 +121,9 @@ func (ehc *EtcHostsContainer) Close() {
|
||||
if ehc.watcher != nil {
|
||||
_ = ehc.watcher.Close()
|
||||
}
|
||||
close(ehc.onlyWritesChan)
|
||||
|
||||
// Don't close onlyWritesChan here and let onlyWrites close it after
|
||||
// watcher.Events is closed to prevent close races.
|
||||
}
|
||||
|
||||
// Process returns the list of IP addresses for the hostname or nil if nothing
|
||||
@@ -298,6 +300,8 @@ func (ehc *EtcHostsContainer) onlyWrites() {
|
||||
ehc.onlyWritesChan <- event
|
||||
}
|
||||
}
|
||||
|
||||
close(ehc.onlyWritesChan)
|
||||
}
|
||||
|
||||
// Receive notifications from fsnotify package
|
||||
|
||||
Reference in New Issue
Block a user