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
@@ -25,7 +25,7 @@ import (
|
||||
type EventType uint64
|
||||
|
||||
const (
|
||||
Ping = 1 << iota
|
||||
Ping EventType = 1 << iota
|
||||
Starting
|
||||
StartupComplete
|
||||
DeviceDiscovered
|
||||
@@ -39,7 +39,7 @@ const (
|
||||
FolderRejected
|
||||
ConfigSaved
|
||||
|
||||
AllEvents = ^EventType(0)
|
||||
AllEvents = (1 << iota) - 1
|
||||
)
|
||||
|
||||
func (t EventType) String() string {
|
||||
@@ -131,7 +131,7 @@ func (l *Logger) Log(t EventType, data interface{}) {
|
||||
select {
|
||||
case s.events <- e:
|
||||
default:
|
||||
//log.Println("Dropping event:", e)
|
||||
// if s.events is not ready, drop the event
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -157,7 +157,7 @@ func (l *Logger) Subscribe(mask EventType) *Subscription {
|
||||
func (l *Logger) Unsubscribe(s *Subscription) {
|
||||
l.mutex.Lock()
|
||||
if debug {
|
||||
dl.Debugln("unsubsribe")
|
||||
dl.Debugln("unsubscribe")
|
||||
}
|
||||
delete(l.subs, s.id)
|
||||
close(s.events)
|
||||
|
||||
Reference in New Issue
Block a user