Unverified Commit d2338373 authored by Andre Heinecke's avatar Andre Heinecke
Browse files

Let the readerstatus thread wait on gpg-agent

When Kleopatra is started the readerstatus thread may check
for smartcards before the gpg-agent and scdaemon are started
which can take a while, especially on Windows. So we now
handle the GPG_ERR_ASS_CONNECT_FAILED and wait for it to
come up. GnuPG itself does something similar.
parent 9653fd44
Pipeline #80697 passed with stage
in 16 minutes and 2 seconds
......@@ -171,6 +171,16 @@ static std::unique_ptr<T> gpgagent_transact(std::shared_ptr<Context> &gpgAgent,
{
qCDebug(KLEOPATRA_LOG) << "gpgagent_transact(" << command << ")";
err = gpgAgent->assuanTransact(command, std::move(transaction));
static int cnt = 0;
while (err.code() == GPG_ERR_ASS_CONNECT_FAILED && cnt < 5) {
// Esp. on Windows the agent processes may take their time so we try
// in increasing waits for them to start up
qCDebug(KLEOPATRA_LOG) << "Waiting for the daemons to start up";
cnt++;
QThread::msleep(250 * cnt);
err = gpgAgent->assuanTransact(command, gpgAgent->takeLastAssuanTransaction());
}
if (err.code()) {
qCDebug(KLEOPATRA_LOG) << "gpgagent_transact(" << command << "): Error:" << err;
if (err.code() >= GPG_ERR_ASS_GENERAL && err.code() <= GPG_ERR_ASS_UNKNOWN_INQUIRE) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment