1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

scd: Modify DEVINFO behavior to support looping forever.

* scd/app.c (struct mrsw_lock): Add notify_cond member.
(notify_cond): Remove.
(card_list_r_lock, card_list_r_unlock): Rename.
(card_list_w_lock, card_list_w_unlock): Rename.
(card_list_signal, card_list_wait): New, fixing thinko about
notify/wakeup with MRSW lock.
(app_send_devinfo): Support looping.
(select_application): Notify app_send_devinfo thread for newly
detected device.
(initialize_module_command): Initialize notify_cond member.
(app_wait): Remove.
* scd/command.c (cmd_devinfo): Use new API of app_send_devinfo.
* scd/scdaemon.h (app_wait): Remove.

--

GnuPG-bug-id: 5359
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2021-10-29 10:48:01 +09:00
parent 50e43af3f1
commit 48e824b6ea
3 changed files with 104 additions and 79 deletions

View file

@ -2279,7 +2279,7 @@ cmd_devinfo (assuan_context_t ctx, char *line)
}
/* Firstly, send information of available devices. */
err = app_send_devinfo (ctrl);
err = app_send_devinfo (ctrl, 0);
/* If not watching, that's all. */
if (!watch)
@ -2311,16 +2311,10 @@ cmd_devinfo (assuan_context_t ctx, char *line)
}
/* Then, keep watching the status change. */
while (!err)
{
app_wait ();
/* Send information of available devices. */
err = app_send_devinfo (ctrl);
}
err = app_send_devinfo (ctrl, 1);
ctrl->server_local->watching_status = 0;
return 0;
return err;
}
/* Return true if the command CMD implements the option OPT. */