Mercurial > dovecot > core-2.2
changeset 21285:2157ee0eee0f
doveadm: When connecting to doveadm-server via TCP, use 30s timeout
Should be enough, and better than the kernel's default, which might be a lot
more.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Mon, 12 Dec 2016 12:51:42 +0200 |
parents | 14739e2a8fb3 |
children | 082164be352a |
files | src/doveadm/doveadm-util.c |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/doveadm/doveadm-util.c Mon Dec 12 10:40:20 2016 +0200 +++ b/src/doveadm/doveadm-util.c Mon Dec 12 12:51:42 2016 +0200 @@ -15,6 +15,8 @@ #include <sys/stat.h> #include <ctype.h> +#define DOVEADM_TCP_CONNECT_TIMEOUT_SECS 30 + bool doveadm_verbose = FALSE, doveadm_debug = FALSE, doveadm_server = FALSE; static struct module *modules = NULL; @@ -104,6 +106,7 @@ unsigned int ips_count; int ret, fd; + alarm(DOVEADM_TCP_CONNECT_TIMEOUT_SECS); ret = net_gethostbyname(host, &ips, &ips_count); if (ret != 0) { i_fatal("Lookup of host %s failed: %s", @@ -114,6 +117,7 @@ i_fatal("connect(%s:%u) failed: %m", net_ip2addr(&ips[0]), port); } + alarm(0); return fd; }