diff options
| author | Arthur de Jong <arthur@arthurdejong.org> | 2013-03-29 20:14:49 +0100 |
|---|---|---|
| committer | Arthur de Jong <arthur@arthurdejong.org> | 2013-03-29 20:17:04 +0100 |
| commit | a75cfb9d5f67dd4be325f151f9e0fc9af0864ac2 (patch) | |
| tree | c99a498301ee2899150ced655437dd61844c0454 /pynslcd/nscd.py | |
| parent | 585d38894b32551fba68ea9b202c12ce5f8cc966 (diff) | |
Detect and handle connection failure and recovery
Logs a connection recovery message and run a nscd cache invalidation if
configured.
Diffstat (limited to 'pynslcd/nscd.py')
| -rw-r--r-- | pynslcd/nscd.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pynslcd/nscd.py b/pynslcd/nscd.py index 89cb483..19e5ceb 100644 --- a/pynslcd/nscd.py +++ b/pynslcd/nscd.py @@ -24,6 +24,8 @@ import os import subprocess import struct +import cfg + # the file descriptor used for sending messages to the child process signalfd = None @@ -100,7 +102,10 @@ def start_invalidator(): def invalidate(db=None): if signalfd is None: return # nothing to do - db = _db_to_char.get(db, '') + if db: + db = _db_to_char.get(db, '') + else: + db = ''.join(_db_to_char[x] for x in cfg.nscd_invalidate) try: os.write(signalfd, db) except: |
