summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2005-06-21 14:14:55 +0000
committerPhilip Hazel <ph10@hermes.cam.ac.uk>2005-06-21 14:14:55 +0000
commit4aee02256cb1542139cdf399bd22bd7496d9611d (patch)
treef8c40423eaa565479dc104767a6f2c7ef7e8620a /src
parent9a26b6b229299c6106f5ab917220f39277b21713 (diff)
Implement daemon_startup_{retries,sleep} to control startup retrying.
Diffstat (limited to 'src')
-rw-r--r--src/src/daemon.c12
-rw-r--r--src/src/globals.c4
-rw-r--r--src/src/globals.h4
-rw-r--r--src/src/readconf.c4
4 files changed, 16 insertions, 8 deletions
diff --git a/src/src/daemon.c b/src/src/daemon.c
index 21d111023..974785c24 100644
--- a/src/src/daemon.c
+++ b/src/src/daemon.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/daemon.c,v 1.10 2005/03/15 14:09:12 ph10 Exp $ */
+/* $Cambridge: exim/src/src/daemon.c,v 1.11 2005/06/21 14:14:55 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -1249,7 +1249,6 @@ if (daemon_listen)
{
BOOL wildcard;
ip_address_item *ipa2;
- int retries = 9;
int af;
if (Ustrchr(ipa->address, ':') != NULL)
@@ -1327,13 +1326,16 @@ if (daemon_listen)
msg = US strerror(errno);
addr = wildcard? ((af == AF_INET6)? US"(any IPv6)" : US"(any IPv4)") :
ipa->address;
- if (retries-- <= 0)
+ if (daemon_startup_retries <= 0)
log_write(0, LOG_MAIN|LOG_PANIC_DIE,
"socket bind() to port %d for address %s failed: %s: "
"daemon abandoned", ipa->port, addr, msg);
log_write(0, LOG_MAIN, "socket bind() to port %d for address %s "
- "failed: %s: waiting before trying again", ipa->port, addr, msg);
- sleep(30);
+ "failed: %s: waiting %s before trying again (%d more %s)",
+ ipa->port, addr, msg, readconf_printtime(daemon_startup_sleep),
+ daemon_startup_retries, (daemon_startup_retries > 1)? "tries" : "try");
+ daemon_startup_retries--;
+ sleep(daemon_startup_sleep);
}
DEBUG(D_any)
diff --git a/src/src/globals.c b/src/src/globals.c
index ee0fb6e65..1f57ff383 100644
--- a/src/src/globals.c
+++ b/src/src/globals.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/globals.c,v 1.29 2005/06/16 20:01:29 tom Exp $ */
+/* $Cambridge: exim/src/src/globals.c,v 1.30 2005/06/21 14:14:55 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -392,6 +392,8 @@ uschar *csa_status = NULL;
BOOL daemon_listen = FALSE;
uschar *daemon_smtp_port = US"smtp";
+int daemon_startup_retries = 9;
+int daemon_startup_sleep = 30;
BOOL debug_daemon = FALSE;
int debug_fd = -1;
FILE *debug_file = NULL;
diff --git a/src/src/globals.h b/src/src/globals.h
index aed97d3e9..0c64224a2 100644
--- a/src/src/globals.h
+++ b/src/src/globals.h
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/globals.h,v 1.21 2005/06/16 20:01:29 tom Exp $ */
+/* $Cambridge: exim/src/src/globals.h,v 1.22 2005/06/21 14:14:55 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -218,6 +218,8 @@ extern uschar *csa_status; /* Client SMTP Authorization result */
extern BOOL daemon_listen; /* True if listening required */
extern uschar *daemon_smtp_port; /* Can be a list of ports */
+extern int daemon_startup_retries; /* Number of times to retry */
+extern int daemon_startup_sleep; /* Sleep between retries */
extern BOOL debug_daemon; /* Debug the daemon process only */
extern int debug_fd; /* The fd for debug_file */
extern FILE *debug_file; /* Where to write debugging info */
diff --git a/src/src/readconf.c b/src/src/readconf.c
index 6a6b3ba2a..b5c113014 100644
--- a/src/src/readconf.c
+++ b/src/src/readconf.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/readconf.c,v 1.9 2005/05/24 08:15:02 tom Exp $ */
+/* $Cambridge: exim/src/src/readconf.c,v 1.10 2005/06/21 14:14:55 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -186,6 +186,8 @@ static optionlist optionlist_config[] = {
{ "check_spool_space", opt_Kint, &check_spool_space },
{ "daemon_smtp_port", opt_stringptr|opt_hidden, &daemon_smtp_port },
{ "daemon_smtp_ports", opt_stringptr, &daemon_smtp_port },
+ { "daemon_startup_retries", opt_int, &daemon_startup_retries },
+ { "daemon_startup_sleep", opt_time, &daemon_startup_sleep },
{ "delay_warning", opt_timelist, &delay_warning },
{ "delay_warning_condition", opt_stringptr, &delay_warning_condition },
{ "deliver_drop_privilege", opt_bool, &deliver_drop_privilege },