Merge remote-tracking branch 'origin/pr/793'

* origin/pr/793:
  Minor fixes.
This commit is contained in:
Jakob Borg 2014-10-07 07:43:23 +02:00
commit 640d5135df
3 changed files with 8 additions and 7 deletions

View File

@ -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))

View File

@ -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)

View File

@ -858,7 +858,8 @@ func TestLongPath(t *testing.T) {
t.Fatalf("Incorrect len %d != 1 for global list", l)
}
if gf[0].Name != local[0].Name {
t.Error("Incorrect long filename;\n%q !=\n%q", gf[0].Name, local[0].Name)
t.Errorf("Incorrect long filename;\n%q !=\n%q",
gf[0].Name, local[0].Name)
}
}