mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
Change backlog from 5 to 64 and provide option --listen-backlog.
* agent/gpg-agent.c (oListenBacklog): New const. (opts): New option --listen-backlog. (listen_backlog): New var. (main): Parse new options. (create_server_socket): Use var instead of 5. * dirmngr/dirmngr.c: Likewise. * scd/scdaemon.c: Likewise. -- GnuPG-bug-id: 3473 Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
17efcd2a2a
commit
c81a447190
@ -136,6 +136,7 @@ enum cmd_and_opt_values
|
||||
oDisableCheckOwnSocket,
|
||||
oS2KCount,
|
||||
oAutoExpandSecmem,
|
||||
oListenBacklog,
|
||||
|
||||
oWriteEnvFile
|
||||
};
|
||||
@ -255,6 +256,8 @@ static ARGPARSE_OPTS opts[] = {
|
||||
|
||||
ARGPARSE_op_u (oAutoExpandSecmem, "auto-expand-secmem", "@"),
|
||||
|
||||
ARGPARSE_s_i (oListenBacklog, "listen-backlog", "@"),
|
||||
|
||||
/* Dummy options for backward compatibility. */
|
||||
ARGPARSE_o_s (oWriteEnvFile, "write-env-file", "@"),
|
||||
ARGPARSE_s_n (oUseStandardSocket, "use-standard-socket", "@"),
|
||||
@ -371,6 +374,10 @@ static assuan_sock_nonce_t socket_nonce_extra;
|
||||
static assuan_sock_nonce_t socket_nonce_browser;
|
||||
static assuan_sock_nonce_t socket_nonce_ssh;
|
||||
|
||||
/* Value for the listen() backlog argument. We use the same value for
|
||||
* all sockets - 64 is on current Linux half of the default maximum.
|
||||
* Let's try this as default. Change at runtime with --listen-backlog. */
|
||||
static int listen_backlog = 64;
|
||||
|
||||
/* Default values for options passed to the pinentry. */
|
||||
static char *default_display;
|
||||
@ -1245,6 +1252,10 @@ main (int argc, char **argv )
|
||||
(unsigned int)pargs.r.ret_ulong, 0);
|
||||
break;
|
||||
|
||||
case oListenBacklog:
|
||||
listen_backlog = pargs.r.ret_int;
|
||||
break;
|
||||
|
||||
case oDebugQuickRandom:
|
||||
/* Only used by the first stage command line parser. */
|
||||
break;
|
||||
@ -2248,9 +2259,10 @@ create_server_socket (char *name, int primary, int cygwin,
|
||||
log_error (_("can't set permissions of '%s': %s\n"),
|
||||
unaddr->sun_path, strerror (errno));
|
||||
|
||||
if (listen (FD2INT(fd), 5 ) == -1)
|
||||
if (listen (FD2INT(fd), listen_backlog ) == -1)
|
||||
{
|
||||
log_error (_("listen() failed: %s\n"), strerror (errno));
|
||||
log_error ("listen(fd,%d) failed: %s\n",
|
||||
listen_backlog, strerror (errno));
|
||||
*name = 0; /* Inhibit removal of the socket by cleanup(). */
|
||||
assuan_sock_close (fd);
|
||||
xfree (unaddr);
|
||||
|
@ -151,6 +151,7 @@ enum cmd_and_opt_values {
|
||||
oResolverTimeout,
|
||||
oConnectTimeout,
|
||||
oConnectQuickTimeout,
|
||||
oListenBacklog,
|
||||
aTest
|
||||
};
|
||||
|
||||
@ -256,6 +257,7 @@ static ARGPARSE_OPTS opts[] = {
|
||||
ARGPARSE_s_i (oResolverTimeout, "resolver-timeout", "@"),
|
||||
ARGPARSE_s_i (oConnectTimeout, "connect-timeout", "@"),
|
||||
ARGPARSE_s_i (oConnectQuickTimeout, "connect-quick-timeout", "@"),
|
||||
ARGPARSE_s_i (oListenBacklog, "listen-backlog", "@"),
|
||||
|
||||
ARGPARSE_group (302,N_("@\n(See the \"info\" manual for a complete listing "
|
||||
"of all commands and options)\n")),
|
||||
@ -296,6 +298,10 @@ static const char *redir_socket_name;
|
||||
POSIX systems). */
|
||||
static assuan_sock_nonce_t socket_nonce;
|
||||
|
||||
/* Value for the listen() backlog argument.
|
||||
* Change at runtime with --listen-backlog. */
|
||||
static int listen_backlog = 64;
|
||||
|
||||
/* Only if this flag has been set will we remove the socket file. */
|
||||
static int cleanup_socket;
|
||||
|
||||
@ -1019,6 +1025,10 @@ main (int argc, char **argv)
|
||||
|
||||
case oSocketName: socket_name = pargs.r.ret_str; break;
|
||||
|
||||
case oListenBacklog:
|
||||
listen_backlog = pargs.r.ret_int;
|
||||
break;
|
||||
|
||||
default : pargs.err = configfp? 1:2; break;
|
||||
}
|
||||
}
|
||||
@ -1263,9 +1273,10 @@ main (int argc, char **argv)
|
||||
log_error (_("can't set permissions of '%s': %s\n"),
|
||||
serv_addr.sun_path, strerror (errno));
|
||||
|
||||
if (listen (FD2INT (fd), 5) == -1)
|
||||
if (listen (FD2INT (fd), listen_backlog) == -1)
|
||||
{
|
||||
log_error (_("listen() failed: %s\n"), strerror (errno));
|
||||
log_error ("listen(fd,%d) failed: %s\n",
|
||||
listen_backlog, strerror (errno));
|
||||
assuan_sock_close (fd);
|
||||
dirmngr_exit (1);
|
||||
}
|
||||
|
@ -282,6 +282,10 @@ default values are 15 and 2 seconds. Note that the timeout values are
|
||||
for each connection attempt; the connection code will attempt to
|
||||
connect all addresses listed for a server.
|
||||
|
||||
@item --listen-backlog @var{n}
|
||||
@opindex listen-backlog
|
||||
Set the size of the queue for pending connections. The default is 64.
|
||||
|
||||
@item --allow-version-check
|
||||
@opindex allow-version-check
|
||||
Allow Dirmngr to connect to @code{https://versions.gnupg.org} to get
|
||||
|
@ -563,6 +563,9 @@ Ignore requests to change the current @code{tty} or X window system's
|
||||
@code{DISPLAY} variable respectively. This is useful to lock the
|
||||
pinentry to pop up at the @code{tty} or display you started the agent.
|
||||
|
||||
@item --listen-backlog @var{n}
|
||||
@opindex listen-backlog
|
||||
Set the size of the queue for pending connections. The default is 64.
|
||||
|
||||
@anchor{option --extra-socket}
|
||||
@item --extra-socket @var{name}
|
||||
|
@ -236,6 +236,12 @@ a list of categories see the Libassuan manual.
|
||||
Don't detach the process from the console. This is mainly useful for
|
||||
debugging.
|
||||
|
||||
@item --listen-backlog @var{n}
|
||||
@opindex listen-backlog
|
||||
Set the size of the queue for pending connections. The default is 64.
|
||||
This option has an effect only if @option{--multi-server} is also
|
||||
used.
|
||||
|
||||
@item --log-file @var{file}
|
||||
@opindex log-file
|
||||
Append all logging output to @var{file}. This is very helpful in
|
||||
|
@ -99,6 +99,7 @@ enum cmd_and_opt_values
|
||||
oDenyAdmin,
|
||||
oDisableApplication,
|
||||
oEnablePinpadVarlen,
|
||||
oListenBacklog
|
||||
};
|
||||
|
||||
|
||||
@ -156,6 +157,7 @@ static ARGPARSE_OPTS opts[] = {
|
||||
ARGPARSE_s_n (oEnablePinpadVarlen, "enable-pinpad-varlen",
|
||||
N_("use variable length input for pinpad")),
|
||||
ARGPARSE_s_s (oHomedir, "homedir", "@"),
|
||||
ARGPARSE_s_i (oListenBacklog, "listen-backlog", "@"),
|
||||
|
||||
ARGPARSE_end ()
|
||||
};
|
||||
@ -224,6 +226,10 @@ static char *redir_socket_name;
|
||||
POSIX systems). */
|
||||
static assuan_sock_nonce_t socket_nonce;
|
||||
|
||||
/* Value for the listen() backlog argument. Change at runtime with
|
||||
* --listen-backlog. */
|
||||
static int listen_backlog = 64;
|
||||
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
static HANDLE the_event;
|
||||
#else
|
||||
@ -594,6 +600,10 @@ main (int argc, char **argv )
|
||||
|
||||
case oEnablePinpadVarlen: opt.enable_pinpad_varlen = 1; break;
|
||||
|
||||
case oListenBacklog:
|
||||
listen_backlog = pargs.r.ret_int;
|
||||
break;
|
||||
|
||||
default:
|
||||
pargs.err = configfp? ARGPARSE_PRINT_WARNING:ARGPARSE_PRINT_ERROR;
|
||||
break;
|
||||
@ -1128,10 +1138,10 @@ create_server_socket (const char *name, char **r_redir_name,
|
||||
log_error (_("can't set permissions of '%s': %s\n"),
|
||||
unaddr->sun_path, strerror (errno));
|
||||
|
||||
if (listen (FD2INT(fd), 5 ) == -1)
|
||||
if (listen (FD2INT(fd), listen_backlog) == -1)
|
||||
{
|
||||
log_error (_("listen() failed: %s\n"),
|
||||
gpg_strerror (gpg_error_from_syserror ()));
|
||||
log_error ("listen(fd, %d) failed: %s\n",
|
||||
listen_backlog, gpg_strerror (gpg_error_from_syserror ()));
|
||||
assuan_sock_close (fd);
|
||||
scd_exit (2);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user