Add a few more debug prints

This commit is contained in:
Jakob Borg 2014-10-16 09:32:23 +02:00
parent d031f958a9
commit 2fb8eb755b
3 changed files with 22 additions and 2 deletions

View File

@ -439,6 +439,9 @@ func (m *Model) Index(deviceID protocol.DeviceID, folder string, fs []protocol.F
for i := 0; i < len(fs); { for i := 0; i < len(fs); {
lamport.Default.Tick(fs[i].Version) lamport.Default.Tick(fs[i].Version)
if ignores != nil && ignores.Match(fs[i].Name) { if ignores != nil && ignores.Match(fs[i].Name) {
if debug{
l.Debugln("dropping update for ignored",fs[i])
}
fs[i] = fs[len(fs)-1] fs[i] = fs[len(fs)-1]
fs = fs[:len(fs)-1] fs = fs[:len(fs)-1]
} else { } else {
@ -480,6 +483,7 @@ func (m *Model) IndexUpdate(deviceID protocol.DeviceID, folder string, fs []prot
for i := 0; i < len(fs); { for i := 0; i < len(fs); {
lamport.Default.Tick(fs[i].Version) lamport.Default.Tick(fs[i].Version)
if ignores != nil && ignores.Match(fs[i].Name) { if ignores != nil && ignores.Match(fs[i].Name) {
l.Debugln("dropping update for ignored",fs[i])
fs[i] = fs[len(fs)-1] fs[i] = fs[len(fs)-1]
fs = fs[:len(fs)-1] fs = fs[:len(fs)-1]
} else { } else {
@ -878,6 +882,7 @@ func sendIndexTo(initial bool, minLocalVer uint64, conn protocol.Connection, fol
} }
if ignores != nil && ignores.Match(f.Name) { if ignores != nil && ignores.Match(f.Name) {
l.Debugln("not sending update for ignored",f)
return true return true
} }
@ -1079,6 +1084,7 @@ func (m *Model) ScanFolderSub(folder, sub string) error {
if ignores != nil && ignores.Match(f.Name) { if ignores != nil && ignores.Match(f.Name) {
// File has been ignored. Set invalid bit. // File has been ignored. Set invalid bit.
l.Debugln("setting invalid bit on ignored",f)
nf := protocol.FileInfo{ nf := protocol.FileInfo{
Name: f.Name, Name: f.Name,
Flags: f.Flags | protocol.FlagInvalid, Flags: f.Flags | protocol.FlagInvalid,

View File

@ -163,6 +163,9 @@ loop:
curVer = lv curVer = lv
} }
prevVer = curVer prevVer = curVer
if debug {
l.Debugln(p, "next pull in", nextPullIntv)
}
pullTimer.Reset(nextPullIntv) pullTimer.Reset(nextPullIntv)
break break
} }
@ -173,6 +176,9 @@ loop:
// errors preventing us. Flag this with a warning and // errors preventing us. Flag this with a warning and
// wait a bit longer before retrying. // wait a bit longer before retrying.
l.Warnf("Folder %q isn't making progress - check logs for possible root cause. Pausing puller for %v.", p.folder, pauseIntv) l.Warnf("Folder %q isn't making progress - check logs for possible root cause. Pausing puller for %v.", p.folder, pauseIntv)
if debug {
l.Debugln(p, "next pull in", pauseIntv)
}
pullTimer.Reset(pauseIntv) pullTimer.Reset(pauseIntv)
break break
} }
@ -193,12 +199,16 @@ loop:
} }
p.model.setState(p.folder, FolderIdle) p.model.setState(p.folder, FolderIdle)
if p.scanIntv > 0 { if p.scanIntv > 0 {
if debug {
l.Debugln(p, "next rescan in", p.scanIntv)
}
scanTimer.Reset(p.scanIntv) scanTimer.Reset(p.scanIntv)
} }
if !initialScanCompleted { if !initialScanCompleted {
l.Infoln("Completed initial scan (rw) of folder", p.folder) l.Infoln("Completed initial scan (rw) of folder", p.folder)
initialScanCompleted = true initialScanCompleted = true
} }
// Clean out old temporaries // Clean out old temporaries
case <-cleanTimer.C: case <-cleanTimer.C:
p.clean() p.clean()

View File

@ -152,7 +152,7 @@ func (w *Walker) walkAndHashFiles(fchan chan protocol.FileInfo) filepath.WalkFun
Modified: info.ModTime().Unix(), Modified: info.ModTime().Unix(),
} }
if debug { if debug {
l.Debugln("dir:", f) l.Debugln("dir:", p, f)
} }
fchan <- f fchan <- f
return nil return nil
@ -176,12 +176,16 @@ func (w *Walker) walkAndHashFiles(fchan chan protocol.FileInfo) filepath.WalkFun
flags = protocol.FlagNoPermBits | 0666 flags = protocol.FlagNoPermBits | 0666
} }
fchan <- protocol.FileInfo{ f := protocol.FileInfo{
Name: rn, Name: rn,
Version: lamport.Default.Tick(0), Version: lamport.Default.Tick(0),
Flags: flags, Flags: flags,
Modified: info.ModTime().Unix(), Modified: info.ModTime().Unix(),
} }
if debug {
l.Debugln("to hash:", p, f)
}
fchan <- f
} }
return nil return nil