mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
dirmngr: Avoid initial delay on the first keyserver access.
* dirmngr/dirmngr.c (dirmngr_never_use_tor_p): New. * dirmngr/server.c (ensure_keyserver): Don't even test for the Tor proxy in never-use-tor Mode. * tools/gpgtar-create.c: Include unistd.h to avoid a warning on Windows. -- This delay of 2 or 3 seconds is in particular annoying on Windows. This is now suppressed, as it should be, if --no-use-tor is used. The second patch is unrelated
This commit is contained in:
parent
623a427b0c
commit
57d546674d
@ -620,6 +620,15 @@ dirmngr_use_tor (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* This is somewhat similar to dirmngr_use_tor but avoids a trial
|
||||||
|
* connect and may thus be faster for this special case. */
|
||||||
|
int
|
||||||
|
dirmngr_never_use_tor_p (void)
|
||||||
|
{
|
||||||
|
return tor_mode == TOR_MODE_NEVER;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wrong_args (const char *text)
|
wrong_args (const char *text)
|
||||||
{
|
{
|
||||||
|
@ -223,6 +223,7 @@ void dirmngr_deinit_default_ctrl (ctrl_t ctrl);
|
|||||||
void dirmngr_sighup_action (void);
|
void dirmngr_sighup_action (void);
|
||||||
const char* dirmngr_get_current_socket_name (void);
|
const char* dirmngr_get_current_socket_name (void);
|
||||||
int dirmngr_use_tor (void);
|
int dirmngr_use_tor (void);
|
||||||
|
int dirmngr_never_use_tor_p (void);
|
||||||
|
|
||||||
/*-- Various housekeeping functions. --*/
|
/*-- Various housekeeping functions. --*/
|
||||||
void ks_hkp_housekeeping (time_t curtime);
|
void ks_hkp_housekeeping (time_t curtime);
|
||||||
|
@ -2276,7 +2276,7 @@ ensure_keyserver (ctrl_t ctrl)
|
|||||||
{
|
{
|
||||||
/* If there is just one onion and one plain keyserver given, we take
|
/* If there is just one onion and one plain keyserver given, we take
|
||||||
only one depending on whether Tor is running or not. */
|
only one depending on whether Tor is running or not. */
|
||||||
if (is_tor_running (ctrl))
|
if (!dirmngr_never_use_tor_p () && is_tor_running (ctrl))
|
||||||
{
|
{
|
||||||
ctrl->server_local->keyservers = onion_items;
|
ctrl->server_local->keyservers = onion_items;
|
||||||
onion_items = NULL;
|
onion_items = NULL;
|
||||||
@ -2287,7 +2287,7 @@ ensure_keyserver (ctrl_t ctrl)
|
|||||||
plain_items = NULL;
|
plain_items = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!is_tor_running (ctrl))
|
else if (dirmngr_never_use_tor_p () || !is_tor_running (ctrl))
|
||||||
{
|
{
|
||||||
/* Tor is not running. It does not make sense to add Onion
|
/* Tor is not running. It does not make sense to add Onion
|
||||||
addresses. */
|
addresses. */
|
||||||
|
@ -28,11 +28,11 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
#include <unistd.h>
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# define WIN32_LEAN_AND_MEAN
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#else /*!HAVE_W32_SYSTEM*/
|
#else /*!HAVE_W32_SYSTEM*/
|
||||||
# include <unistd.h>
|
|
||||||
# include <pwd.h>
|
# include <pwd.h>
|
||||||
# include <grp.h>
|
# include <grp.h>
|
||||||
#endif /*!HAVE_W32_SYSTEM*/
|
#endif /*!HAVE_W32_SYSTEM*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user