Minor fixes.
- Bug fix - use .Errorf() instead of .Error(): Before this change, an error message for failed tests in files/set_test.go wrongly tried to use format strings in a call to .Error() - Change event constants to be of type EventType rather than untyped integers. - Slightly relax the locking for registry cache lookups: For read access to Discover.registry we only need to take a read lock. - Some cosmetic fixes.
This commit is contained in:
committed by
Jochen Voss (voss@sushi)
parent
d819151020
commit
1a2a27b988
@@ -132,9 +132,9 @@ func (d *Discoverer) ExtAnnounceOK() bool {
|
||||
}
|
||||
|
||||
func (d *Discoverer) Lookup(device protocol.DeviceID) []string {
|
||||
d.registryLock.Lock()
|
||||
d.registryLock.RLock()
|
||||
cached := d.filterCached(d.registry[device])
|
||||
d.registryLock.Unlock()
|
||||
d.registryLock.RUnlock()
|
||||
|
||||
if len(cached) > 0 {
|
||||
addrs := make([]string, len(cached))
|
||||
|
||||
Reference in New Issue
Block a user