diff options
author | Christian Kamm <mail@ckamm.de> | 2017-10-09 13:06:57 +0300 |
---|---|---|
committer | ckamm <mail@ckamm.de> | 2017-10-24 11:00:20 +0300 |
commit | 66f0ce6616edcb6e44d235ae779170eb28c9c7c0 (patch) | |
tree | d3163e0d4e2adffd37c05f9a1d293a06c0a4b439 /src/gui/folderwatcher_linux.cpp | |
parent | fb2d31c9cedd10bc3b0cee7ccfff0756f6615386 (diff) |
FolderWatcher: reliability and data-loss signal
Add state and signal to catch the following two known problems:
* Linux: inotify user watch pool is exhausted. Folder watcher becomes
unreliable.
* Windows: buffer is too small, some notifications are lost but watching
stays reliable.
Diffstat (limited to 'src/gui/folderwatcher_linux.cpp')
-rw-r--r-- | src/gui/folderwatcher_linux.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gui/folderwatcher_linux.cpp b/src/gui/folderwatcher_linux.cpp index f0e0eb0e4..37d79211a 100644 --- a/src/gui/folderwatcher_linux.cpp +++ b/src/gui/folderwatcher_linux.cpp @@ -78,6 +78,12 @@ void FolderWatcherPrivate::inotifyRegisterPath(const QString &path) IN_CLOSE_WRITE | IN_ATTRIB | IN_MOVE | IN_CREATE | IN_DELETE | IN_DELETE_SELF | IN_MOVE_SELF | IN_UNMOUNT | IN_ONLYDIR); if (wd > -1) { _watches.insert(wd, path); + } else { + // If we're running out of memory or inotify watches, become + // unreliable. + if (errno == ENOMEM || errno == ENOSPC) { + _parent->_isReliable = false; + } } } } |