aboutsummaryrefslogtreecommitdiffstats
path: root/scd/scdaemon.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2017-01-31 23:58:01 +0000
committerNIIBE Yutaka <[email protected]>2017-01-31 23:58:01 +0000
commit8ddc9268f6aedef0e178b174b89245c33d8189dd (patch)
tree3c8d6624f74edcbde55d8d6cd8bdc82b8dd1e22d /scd/scdaemon.c
parentgpgscm: Tune the hash tables. (diff)
downloadgnupg-8ddc9268f6aedef0e178b174b89245c33d8189dd.tar.gz
gnupg-8ddc9268f6aedef0e178b174b89245c33d8189dd.zip
scd: Fix regression tracking the connection count.
* scd/scdaemon.c (get_active_connection_count): New. (start_connection_thread): Bump ACTIVE_CONNECTIONS up and down. * scd/command.c (cmd_getinfo): Add subcommand "connections". -- Apply gpg-agent change to scdaemon. See the commit in 2016-08-06: 40d16029ed8b334c371fa7f24ac762d47302826e Then, add kicking the loop, so that main loop can notice the change of the connection. Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'scd/scdaemon.c')
-rw-r--r--scd/scdaemon.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/scd/scdaemon.c b/scd/scdaemon.c
index 7972abd1b..e4b0ef894 100644
--- a/scd/scdaemon.c
+++ b/scd/scdaemon.c
@@ -1150,6 +1150,8 @@ start_connection_thread (void *arg)
return NULL;
}
+ active_connections++;
+
scd_init_default_ctrl (ctrl);
if (opt.verbose)
log_info (_("handler for fd %d started\n"),
@@ -1169,6 +1171,10 @@ start_connection_thread (void *arg)
scd_deinit_default_ctrl (ctrl);
xfree (ctrl);
+
+ if (--active_connections == 0)
+ scd_kick_the_loop ();
+
return NULL;
}
@@ -1349,3 +1355,10 @@ handle_connections (int listen_fd)
log_info (_("%s %s stopped\n"), strusage(11), strusage(13));
npth_attr_destroy (&tattr);
}
+
+/* Return the number of active connections. */
+int
+get_active_connection_count (void)
+{
+ return active_connections;
+}