diff options
author | Daniel Kahn Gillmor <[email protected]> | 2016-10-31 23:52:31 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2016-11-29 13:32:31 +0000 |
commit | f6728d13e8e544dbd4b9351ed981613e5504293f (patch) | |
tree | bdb719800f062c78efe0d2a971c0edc0b5fe3dae /dirmngr/ldap-wrapper.c | |
parent | build: Remove more keywords from the generated ChangeLog (diff) | |
download | gnupg-f6728d13e8e544dbd4b9351ed981613e5504293f.tar.gz gnupg-f6728d13e8e544dbd4b9351ed981613e5504293f.zip |
dirmngr: Lazily launch ldap reaper thread.
* dirmngr/dirmngr.c (main): Avoid calling ldap_wrapper_launch_thread()
Before we need it.
* dirmngr/ldap-wrapper.c (ldap_wrapper): Call
ldap_wrapper_launch_thread() just in time (before any attempt to use
an ldap subprocess).
--
A dirmngr process that never looks anything up in LDAP has no need for
a reaper thread, but one was started automatically. This thread wakes
up every two seconds to look for ldap processes that might never have
been running. We won't start more than one reaper thread for any
given dirmngr due to the static int "done" in
ldap_wrapper_launch_thread(), so it's safe to call this every time
there is a use of ldap_wrapper.
If someone wants to do further dirmngr optimizations for ldap users,
the reaper thread itself could use dynamically-calculated timeouts
(and probably needs to be alerted dynamically when a new ldap
subprocess is available so it can re-calculate those timeouts).
Note: It's not clear to me how to test ldap access effectively; i know
of no public ldap services that i can verify against, and i do not run
my own ldap servers. If someone has a publicly-available ldap server
that developers can run tests against, i would be happy to hear about
it.
Signed-off-by: Daniel Kahn Gillmor <[email protected]>
Diffstat (limited to 'dirmngr/ldap-wrapper.c')
-rw-r--r-- | dirmngr/ldap-wrapper.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/dirmngr/ldap-wrapper.c b/dirmngr/ldap-wrapper.c index b9931a099..b313848e1 100644 --- a/dirmngr/ldap-wrapper.c +++ b/dirmngr/ldap-wrapper.c @@ -654,8 +654,9 @@ ldap_wrapper (ctrl_t ctrl, ksba_reader_t *reader, const char *argv[]) only viable solutions are either to have another thread responsible for logging the messages or to add an option to the wrapper module to do the logging on its own. Given that we anyway - need a way to rip the child process and this is best done using a - general ripping thread, that thread can do the logging too. */ + need a way to reap the child process and this is best done using a + general reaping thread, that thread can do the logging too. */ + ldap_wrapper_launch_thread (); *reader = NULL; |