all: Add filesystem notification support

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3986
This commit is contained in:
Michael Ploujnikov
2017-10-20 14:52:55 +00:00
committed by Audrius Butkevicius
parent c704ba9ef9
commit f98c21b68e
62 changed files with 6079 additions and 18 deletions

View File

@@ -34,11 +34,20 @@ func (f *sendOnlyFolder) Serve() {
f.scan.timer.Stop()
}()
if f.FSWatcherEnabled {
f.startWatcher()
}
for {
select {
case <-f.ctx.Done():
return
case <-f.ignoresUpdated:
if f.FSWatcherEnabled {
f.restartWatcher()
}
case <-f.scan.timer.C:
l.Debugln(f, "Scanning subdirectories")
f.scanTimerFired()
@@ -48,6 +57,10 @@ func (f *sendOnlyFolder) Serve() {
case next := <-f.scan.delay:
f.scan.timer.Reset(next)
case fsEvents := <-f.watchChan:
l.Debugln(f, "filesystem notification rescan")
f.scanSubdirs(fsEvents)
}
}
}