Perform initial scan asynchronously (fixes #509, fixes #464)

This commit is contained in:
Jakob Borg
2014-09-30 17:34:31 +02:00
parent 3eb000fa60
commit 2091e12e82
4 changed files with 18 additions and 48 deletions

View File

@@ -73,11 +73,6 @@ func (w *Walker) Walk() (chan protocol.FileInfo, error) {
return hashedFiles, nil
}
// CleanTempFiles removes all files that match the temporary filename pattern.
func (w *Walker) CleanTempFiles() {
filepath.Walk(w.Dir, w.cleanTempFile)
}
func (w *Walker) walkAndHashFiles(fchan chan protocol.FileInfo) filepath.WalkFunc {
return func(p string, info os.FileInfo, err error) error {
if err != nil {
@@ -181,16 +176,6 @@ func (w *Walker) walkAndHashFiles(fchan chan protocol.FileInfo) filepath.WalkFun
}
}
func (w *Walker) cleanTempFile(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if info.Mode()&os.ModeType == 0 && w.TempNamer.IsTemporary(path) {
os.Remove(path)
}
return nil
}
func checkDir(dir string) error {
if info, err := os.Lstat(dir); err != nil {
return err