mirror of https://github.com/fail2ban/fail2ban
				
				
				
			pyinotify-backend: stability fix for sporadically errors in multi-threaded environment (without lock)
							parent
							
								
									8c4eebc3e3
								
							
						
					
					
						commit
						4404642fa3
					
				| 
						 | 
				
			
			@ -119,13 +119,14 @@ class FilterPyinotify(FileFilter):
 | 
			
		|||
		logSys.debug("Added file watcher for %s", path)
 | 
			
		||||
 | 
			
		||||
	def _delFileWatcher(self, path):
 | 
			
		||||
		wdInt = self.__watches[path]
 | 
			
		||||
		try:
 | 
			
		||||
			wdInt = self.__watches.pop(path)
 | 
			
		||||
			wd = self.__monitor.rm_watch(wdInt)
 | 
			
		||||
			if wd[wdInt]:
 | 
			
		||||
			del self.__watches[path]
 | 
			
		||||
				logSys.debug("Removed file watcher for %s", path)
 | 
			
		||||
				return True
 | 
			
		||||
		else:
 | 
			
		||||
		except KeyError: # pragma: no cover
 | 
			
		||||
			pass
 | 
			
		||||
		return False
 | 
			
		||||
 | 
			
		||||
	##
 | 
			
		||||
| 
						 | 
				
			
			@ -158,8 +159,11 @@ class FilterPyinotify(FileFilter):
 | 
			
		|||
					if k.startswith(path_dir + pathsep)]):
 | 
			
		||||
			# Remove watches for the directory
 | 
			
		||||
			# since there is no other monitored file under this directory
 | 
			
		||||
			try:
 | 
			
		||||
				wdInt = self.__watches.pop(path_dir)
 | 
			
		||||
				self.__monitor.rm_watch(wdInt)
 | 
			
		||||
			except KeyError: # pragma: no cover
 | 
			
		||||
				pass
 | 
			
		||||
			logSys.debug("Removed monitor for the parent directory %s", path_dir)
 | 
			
		||||
 | 
			
		||||
	# pyinotify.ProcessEvent default handler:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue