dirmngr: After a connection failure log a hint if Tor is not running.
authorWerner Koch <wk@gnupg.org>
Wed, 11 Jan 2017 16:09:16 +0000 (17:09 +0100)
committerWerner Koch <wk@gnupg.org>
Wed, 11 Jan 2017 16:09:16 +0000 (17:09 +0100)
* dirmngr/ks-engine-hkp.c (handle_send_request_error): Check whether
Tor is running.

Signed-off-by: Werner Koch <wk@gnupg.org>
dirmngr/ks-engine-hkp.c

index ddeba45..5febb13 100644 (file)
@@ -1138,6 +1138,17 @@ handle_send_request_error (gpg_error_t err, const char *request,
   switch (gpg_err_code (err))
     {
     case GPG_ERR_ECONNREFUSED:
+      if (opt.use_tor)
+        {
+          assuan_fd_t sock;
+
+          sock = assuan_sock_connect_byname (NULL, 0, 0, NULL, ASSUAN_SOCK_TOR);
+          if (sock == ASSUAN_INVALID_FD)
+            log_info ("(it seems Tor is not running)\n");
+          else
+            assuan_sock_close (sock);
+        }
+      /*FALLTHRU*/
     case GPG_ERR_ENETUNREACH:
     case GPG_ERR_ENETDOWN:
     case GPG_ERR_UNKNOWN_HOST: