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/command.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 'agent/command.c')
| -rw-r--r-- | agent/command.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/agent/command.c b/agent/command.c index 1803b5f4e..7fc28ad96 100644 --- a/agent/command.c +++ b/agent/command.c @@ -2775,6 +2775,7 @@ static const char hlp_getinfo[] = " std_startup_env - List the standard startup environment.\n" " cmd_has_option\n" " - Returns OK if the command CMD implements the option OPT.\n" + " connections - Return number of active connections.\n" " restricted - Returns OK if the connection is in restricted mode.\n"; static gpg_error_t cmd_getinfo (assuan_context_t ctx, char *line) @@ -2907,6 +2908,14 @@ cmd_getinfo (assuan_context_t ctx, char *line) } } } + else if (!strcmp (line, "connections")) + { + char numbuf[20]; + + snprintf (numbuf, sizeof numbuf, "%d", + get_agent_active_connection_count ()); + rc = assuan_send_data (ctx, numbuf, strlen (numbuf)); + } else rc = set_error (GPG_ERR_ASS_PARAMETER, "unknown value for WHAT"); return rc; |
