mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
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 <wk@gnupg.org>
This commit is contained in:
parent
894789c329
commit
40d16029ed
3 changed files with 22 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue