dirmngr/src (ChangeLog crlfetch.h dirmngr.c ldap.c)
cvs user wk
cvs at cvs.gnupg.org
Fri Dec 17 16:11:37 CET 2004
Date: Friday, December 17, 2004 @ 16:16:12
Author: wk
Path: /cvs/dirmngr/dirmngr/src
Modified: ChangeLog crlfetch.h dirmngr.c ldap.c
* dirmngr.c (launch_ripper_thread): Renamed to launch_reaper_thread.
(shutdown_reaper): New. Use it for --server and --daemon.
* ldap.c (ldap_wrapper_wait_connections): New.
------------+
ChangeLog | 6 ++++++
crlfetch.h | 1 +
dirmngr.c | 27 +++++++++++++++++----------
ldap.c | 12 +++++++++++-
4 files changed, 35 insertions(+), 11 deletions(-)
Index: dirmngr/src/ChangeLog
diff -u dirmngr/src/ChangeLog:1.38 dirmngr/src/ChangeLog:1.39
--- dirmngr/src/ChangeLog:1.38 Fri Dec 17 11:42:18 2004
+++ dirmngr/src/ChangeLog Fri Dec 17 16:16:12 2004
@@ -1,5 +1,11 @@
2004-12-17 Werner Koch <wk at g10code.com>
+ * dirmngr.c (launch_ripper_thread): Renamed to launch_reaper_thread.
+ (shutdown_reaper): New. Use it for --server and --daemon.
+ * ldap.c (ldap_wrapper_wait_connections): New.
+
+2004-12-17 Werner Koch <wk at g10code.com>
+
* Makefile.am (dirmngr_ldap_LDADD): Adjusted for new LDAP checks.
2004-12-16 Werner Koch <wk at g10code.com>
Index: dirmngr/src/crlfetch.h
diff -u dirmngr/src/crlfetch.h:1.12 dirmngr/src/crlfetch.h:1.13
--- dirmngr/src/crlfetch.h:1.12 Fri Nov 19 16:27:28 2004
+++ dirmngr/src/crlfetch.h Fri Dec 17 16:16:12 2004
@@ -58,6 +58,7 @@
/*-- ldap.c --*/
void *ldap_wrapper_thread (void*);
+void ldap_wrapper_wait_connections (void);
void ldap_wrapper_release_context (ksba_reader_t reader);
void ldap_wrapper_connection_cleanup (ctrl_t);
Index: dirmngr/src/dirmngr.c
diff -u dirmngr/src/dirmngr.c:1.53 dirmngr/src/dirmngr.c:1.54
--- dirmngr/src/dirmngr.c:1.53 Wed Dec 15 23:11:59 2004
+++ dirmngr/src/dirmngr.c Fri Dec 17 16:16:12 2004
@@ -339,9 +339,9 @@
}
-/* Helper to start the ripper thread for the ldap wrapper. */
+/* Helper to start the reaper thread for the ldap wrapper. */
static void
-launch_ripper_thread (void)
+launch_reaper_thread (void)
{
static int done;
pth_attr_t tattr;
@@ -353,17 +353,22 @@
tattr = pth_attr_new();
pth_attr_set (tattr, PTH_ATTR_JOINABLE, 0);
pth_attr_set (tattr, PTH_ATTR_STACK_SIZE, 256*1024);
- pth_attr_set (tattr, PTH_ATTR_NAME, "ldap-ripper");
+ pth_attr_set (tattr, PTH_ATTR_NAME, "ldap-reaper");
if (!pth_spawn (tattr, ldap_wrapper_thread, NULL))
{
- log_error (_("error spawning ldap wrapper ripper thread: %s\n"),
+ log_error (_("error spawning ldap wrapper reaper thread: %s\n"),
strerror (errno) );
dirmngr_exit (1);
}
}
-
+/* Helper to stop the reaper thread for the ldap wrapper. */
+static void
+shutdown_reaper (void)
+{
+ ldap_wrapper_wait_connections ();
+}
/* Handle options which are allowed to be reset after program start.
Return true if the current option in PARGS could be handled and
@@ -756,10 +761,11 @@
log_debug ("... okay\n");
}
- launch_ripper_thread ();
+ launch_reaper_thread ();
cert_cache_init ();
crl_cache_init ();
start_command_handler (-1);
+ shutdown_reaper ();
}
else if (cmd == aDaemon)
{
@@ -907,24 +913,25 @@
}
}
- launch_ripper_thread ();
+ launch_reaper_thread ();
cert_cache_init ();
crl_cache_init ();
handle_connections (fd);
close (fd);
+ shutdown_reaper ();
}
else if (cmd == aListCRLs)
{
/* Just list the CRL cache and exit. */
if (argc)
wrong_args ("--list-crls");
- launch_ripper_thread ();
+ launch_reaper_thread ();
crl_cache_init ();
crl_cache_list (stdout);
}
else if (cmd == aLoadCRL)
{
- launch_ripper_thread ();
+ launch_reaper_thread ();
cert_cache_init ();
crl_cache_init ();
if (!argc)
@@ -946,7 +953,7 @@
memset (&ctrlbuf, 0, sizeof ctrlbuf);
dirmngr_init_default_ctrl (&ctrlbuf);
- launch_ripper_thread ();
+ launch_reaper_thread ();
cert_cache_init ();
crl_cache_init ();
rc = crl_fetch (&ctrlbuf, argv[0], &reader);
Index: dirmngr/src/ldap.c
diff -u dirmngr/src/ldap.c:1.44 dirmngr/src/ldap.c:1.45
--- dirmngr/src/ldap.c:1.44 Thu Dec 16 08:49:25 2004
+++ dirmngr/src/ldap.c Fri Dec 17 16:16:12 2004
@@ -360,6 +360,17 @@
}
+
+/* Wait until all ldap wrappers have terminated. We assume that the
+ kill has already been sent to all of them. */
+void
+ldap_wrapper_wait_connections ()
+{
+ while (wrapper_list)
+ pth_yield (NULL);
+}
+
+
/* This function is to be used to release a context associated with the
given reader object. */
void
@@ -413,7 +424,6 @@
}
}
-
/* This is the callback used by the ldap wrapper to feed the ksba
reader with the wrappers stdout. See the description of
ksba_reader_set_cb for details. */
More information about the Gnupg-commits
mailing list