mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
dirmngr: Add a background task framework.
* dirmngr/workqueue.c: New.
* dirmngr/Makefile.am (dirmngr_SOURCES): Add new file.
* dirmngr/server.c (server_local_s): New field session_id.
(cmd_wkd_get): Add a task.
(task_check_wkd_support): New stub function.
(cmd_getinfo): New sub-commands "session_id" and "workqueue".
(start_command_handler): Add arg session_id and store it in
SERVER_LOCAL.
(dirmngr_status_helpf): New.
* dirmngr/dirmngr.h (wqtask_t): New type.
* dirmngr/dirmngr.c (main): Pass 0 as session_id to
start_command_handler.
(start_connection_thread): Introduce a session_id and pass it to
start_command_handler. Run post session tasks.
(housekeeping_thread): Run global workqueue tasks.
--
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 96a4fbecd1
)
This commit is contained in:
parent
7a663c296e
commit
f2997adee0
5 changed files with 305 additions and 12 deletions
|
@ -228,9 +228,11 @@ ksba_cert_t get_cert_local_ski (ctrl_t ctrl,
|
|||
gpg_error_t get_istrusted_from_client (ctrl_t ctrl, const char *hexfpr);
|
||||
int dirmngr_assuan_log_monitor (assuan_context_t ctx, unsigned int cat,
|
||||
const char *msg);
|
||||
void start_command_handler (gnupg_fd_t fd);
|
||||
void start_command_handler (gnupg_fd_t fd, unsigned int session_id);
|
||||
gpg_error_t dirmngr_status (ctrl_t ctrl, const char *keyword, ...);
|
||||
gpg_error_t dirmngr_status_help (ctrl_t ctrl, const char *text);
|
||||
gpg_error_t dirmngr_status_helpf (ctrl_t ctrl, const char *format,
|
||||
...) GPGRT_ATTR_PRINTF(2,3);
|
||||
gpg_error_t dirmngr_status_printf (ctrl_t ctrl, const char *keyword,
|
||||
const char *format,
|
||||
...) GPGRT_ATTR_PRINTF(3,4);
|
||||
|
@ -258,6 +260,15 @@ void domaininfo_set_wkd_supported (const char *domain);
|
|||
void domaininfo_set_wkd_not_supported (const char *domain);
|
||||
void domaininfo_set_wkd_not_found (const char *domain);
|
||||
|
||||
/*-- workqueue.c --*/
|
||||
typedef const char *(*wqtask_t)(ctrl_t ctrl, const char *args);
|
||||
|
||||
void workqueue_dump_queue (ctrl_t ctrl);
|
||||
gpg_error_t workqueue_add_task (wqtask_t func, const char *args,
|
||||
unsigned int session_id, int need_network);
|
||||
void workqueue_run_global_tasks (ctrl_t ctrl, int with_network);
|
||||
void workqueue_run_post_session_tasks (unsigned int session_id);
|
||||
|
||||
|
||||
|
||||
#endif /*DIRMNGR_H*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue