diff options
author | Sebastien Martini <seb@dbzteam.org> | 2010-01-13 19:38:20 +0100 |
---|---|---|
committer | Sebastien Martini <seb@dbzteam.org> | 2010-01-13 19:38:20 +0100 |
commit | d334049eed6b1136a9d224a3ca17aa66fea5215a (patch) | |
tree | 15bac5ff5b4819a0b624fe04d9104567f082f7f3 | |
parent | c3cdeba1d668eb2f3c3fed3e1c30cbb1235e9196 (diff) | |
download | pyinotify-d334049eed6b1136a9d224a3ca17aa66fea5215a.tar.gz |
Refinement of previous commit implemented with help of patch of
Guillermo Gonzalez <guillermo.gonzalez@canonical.com>.
-rwxr-xr-x | python2/pyinotify.py | 16 | ||||
-rwxr-xr-x | python3/pyinotify.py | 16 |
2 files changed, 14 insertions, 18 deletions
diff --git a/python2/pyinotify.py b/python2/pyinotify.py index e2a50ba..7fd9015 100755 --- a/python2/pyinotify.py +++ b/python2/pyinotify.py @@ -730,13 +730,6 @@ class _SysProcessEvent(_ProcessEvent): IN_OPEN, IN_DELETE, IN_DELETE_SELF, IN_UNMOUNT. """ watch_ = self._watch_manager.get_watch(raw_event.wd) - if watch_ is None: - # Not really sure how we ended up here, nor how we should - # handle these types of events and if it is appropriate to - # completly skip them or not (like we are doing here). - log.debug("Unable to retrieve Watch object associated to event %s", - repr(raw_event)) - return if raw_event.mask & (IN_DELETE_SELF | IN_MOVE_SELF): # Unfornulately this information is not provided by the kernel dir_ = watch_.dir @@ -1128,9 +1121,14 @@ class Notifier: while self._eventq: raw_event = self._eventq.popleft() # pop next event watch_ = self._watch_manager.get_watch(raw_event.wd) - revent = self._sys_proc_fun(raw_event) # system processings - if revent is None: + if watch_ is None: + # Not really sure how we ended up here, nor how we should + # handle these types of events and if it is appropriate to + # completly skip them (like we are doing here). + log.warning("Unable to retrieve Watch object associated to %s", + repr(raw_event)) continue + revent = self._sys_proc_fun(raw_event) # system processings if watch_ and watch_.proc_fun: watch_.proc_fun(revent) # user processings else: diff --git a/python3/pyinotify.py b/python3/pyinotify.py index 3aa9213..6f836f5 100755 --- a/python3/pyinotify.py +++ b/python3/pyinotify.py @@ -694,13 +694,6 @@ class _SysProcessEvent(_ProcessEvent): IN_OPEN, IN_DELETE, IN_DELETE_SELF, IN_UNMOUNT. """ watch_ = self._watch_manager.get_watch(raw_event.wd) - if watch_ is None: - # Not really sure how we ended up here, nor how we should - # handle these types of events and if it is appropriate to - # completly skip them or not (like we are doing here). - log.debug("Unable to retrieve Watch object associated to event %s", - repr(raw_event)) - return if raw_event.mask & (IN_DELETE_SELF | IN_MOVE_SELF): # Unfornulately this information is not provided by the kernel dir_ = watch_.dir @@ -1091,9 +1084,14 @@ class Notifier: while self._eventq: raw_event = self._eventq.popleft() # pop next event watch_ = self._watch_manager.get_watch(raw_event.wd) - revent = self._sys_proc_fun(raw_event) # system processings - if revent is None: + if watch_ is None: + # Not really sure how we ended up here, nor how we should + # handle these types of events and if it is appropriate to + # completly skip them (like we are doing here). + log.warning("Unable to retrieve Watch object associated to %s", + repr(raw_event)) continue + revent = self._sys_proc_fun(raw_event) # system processings if watch_ and watch_.proc_fun: watch_.proc_fun(revent) # user processings else: |