diff options
author | Werner Koch <[email protected]> | 2016-08-06 08:14:17 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2016-08-06 08:15:47 +0000 |
commit | 40d16029ed8b334c371fa7f24ac762d47302826e (patch) | |
tree | be45cdb7a072cbd704c9e0fe35970a0590b1ceb7 /agent/gpg-agent.c | |
parent | agent: Clean up SSH support. (diff) | |
download | gnupg-40d16029ed8b334c371fa7f24ac762d47302826e.tar.gz gnupg-40d16029ed8b334c371fa7f24ac762d47302826e.zip |
agent: Fix long standing regression tracking the connection count.
* agent/gpg-agent.c (get_agent_active_connection_count): New.
(do_start_connection_thread, start_connection_thread_ssh): Bump
ACTIVE_CONNECTIONS up and down.
* agent/command.c (cmd_getinfo): Add subcommand "connections".
--
The variable ACTIVE_CONNECTIONS is used to shutdown gpg-agent in a
friendly way. Before we switched to nPth a Pth provided count of
threads was used for this. During the migration to nPth
ACTIVE_CONNECTIONS was introduced and checked but never set.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to '')
-rw-r--r-- | agent/gpg-agent.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c index 90b0eaf35..8a957cc36 100644 --- a/agent/gpg-agent.c +++ b/agent/gpg-agent.c @@ -1694,6 +1694,14 @@ get_agent_ssh_socket_name (void) } +/* Return the number of active connections. */ +int +get_agent_active_connection_count (void) +{ + return active_connections; +} + + /* Under W32, this function returns the handle of the scdaemon notification event. Calling it the first time creates that event. */ @@ -2302,6 +2310,7 @@ putty_message_thread (void *arg) static void * do_start_connection_thread (ctrl_t ctrl) { + active_connections++; agent_init_default_ctrl (ctrl); if (opt.verbose) log_info (_("handler 0x%lx for fd %d started\n"), @@ -2314,6 +2323,7 @@ do_start_connection_thread (ctrl_t ctrl) agent_deinit_default_ctrl (ctrl); xfree (ctrl); + active_connections--; return NULL; } @@ -2380,6 +2390,7 @@ start_connection_thread_ssh (void *arg) if (check_nonce (ctrl, &socket_nonce_ssh)) return NULL; + active_connections++; agent_init_default_ctrl (ctrl); if (opt.verbose) log_info (_("ssh handler 0x%lx for fd %d started\n"), @@ -2392,6 +2403,7 @@ start_connection_thread_ssh (void *arg) agent_deinit_default_ctrl (ctrl); xfree (ctrl); + active_connections--; return NULL; } |