diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2006-11-10 14:30:35 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2006-11-10 14:30:35 +0000 |
commit | 472d738dfbf6e64523d74840857a4b5aaf2a1044 (patch) | |
tree | 10ca406d2b7fd8016905cb4212be8d40583eb487 | |
parent | 254c2f6386991f906396a6f74b33618c23aae8a3 (diff) | |
download | mailfromd-472d738dfbf6e64523d74840857a4b5aaf2a1044.tar.gz mailfromd-472d738dfbf6e64523d74840857a4b5aaf2a1044.tar.bz2 |
(io_attempts,connect_attempts): Remove
(io_timeout,connect_timeout): Change the type to time_t
(response_timeout): New variable
(option_cache): Deprecate options connect-retry and
io-retry
(process_options): Additionally check if p->set is not NULL.
git-svn-id: file:///svnroot/mailfromd/branches/release_3_0_patches@842 7a8a7f39-df28-0410-adc6-e0d955640f24
-rw-r--r-- | src/main.c | 48 |
1 files changed, 23 insertions, 25 deletions
@@ -97,12 +97,13 @@ char *file_option; /* File name for DB management commands */ struct db_format *format_option; /* Connect settings */ -unsigned connect_timeout = 30; -unsigned connect_attempts = 1; +time_t connect_timeout = 10; /* I/O settings */ -unsigned io_timeout = 3; -unsigned io_attempts = 3; +time_t io_timeout = 3; + +/* Initial response settings */ +time_t response_timeout = 3; /* Logging & debugging */ @@ -289,6 +290,13 @@ host_in_relayed_domain_p(char *client) values in option_cache. Finally, process_options() is called that scans the cache and actually sets any options found there. */ +int +option_deprecated(char *opt, void **pval, char *newval) +{ + parse_error("deprecated option %s ignored", opt); + return 0; +} + void set_ehlo(void *value) { @@ -425,12 +433,6 @@ set_mailfrom(void *value) } void -set_io_attempts(void *value) -{ - io_attempts = strtoul(value, NULL, 0); -} - -void set_io_timeout(void *value) { io_timeout = *(time_t*) value; @@ -438,15 +440,16 @@ set_io_timeout(void *value) } void -set_connect_attempts(void *value) +set_connect_timeout(void *value) { - connect_attempts = strtoul(value, NULL, 0); + connect_timeout = *(time_t*) value; + free(value); } void -set_connect_timeout(void *value) +set_response_timeout(void *value) { - connect_timeout = *(time_t*) value; + response_timeout = *(time_t*) value; free(value); } @@ -682,12 +685,14 @@ struct option_cache { { "milter-timeout", NULL, option_time, set_milter_timeout }, { "pidfile", NULL, option_pidfile, set_pidfile }, { "mailfrom", NULL, option_email, set_mailfrom }, - { "retry", NULL, option_number, set_io_attempts }, + { "retry", NULL, option_deprecated, NULL }, { "timeout", NULL, option_time, set_io_timeout }, - { "io-retry", NULL, option_number, set_io_attempts }, + { "io-retry", NULL, option_deprecated, NULL }, { "io-timeout", NULL, option_time, set_io_timeout }, - { "connect-retry", NULL, option_number, set_connect_attempts }, + { "connect-retry", NULL, option_deprecated, NULL }, { "connect-timeout", NULL, option_time, set_connect_timeout }, + { "initial-response-timeout", NULL, option_time, + set_response_timeout }, { "relay", NULL, option_relay, set_relay, 1 }, { "source", NULL, option_source, set_source }, { "lock-retry-count", NULL, option_number, set_lock_retry_count }, @@ -725,7 +730,7 @@ process_options() struct option_cache *p; for (p = option_cache; p->name; p++) - if (p->value) + if (p->value && p->set) p->set(p->value); } @@ -757,7 +762,6 @@ enum mailfromd_option { OPTION_PIDFILE, OPTION_POSTMASTER_EMAIL, OPTION_PREDICT_NEXT, - OPTION_RETRY, OPTION_SHOW_DEFAULTS, OPTION_SOURCE_INFO, OPTION_SYSLOG, @@ -858,8 +862,6 @@ static struct argp_option options[] = { N_("Set MTA connection timeout"), GRP+1 }, { "timeout", OPTION_TIMEOUT, N_("NUMBER"), 0, N_("Set I/O operation timeout (seconds)"), GRP+1 }, - { "retry", OPTION_RETRY, N_("NUMBER"), 0, - N_("Retry failed I/O operations NUMBER times"), GRP+1 }, { "relayed-domain-file", OPTION_DOMAIN_FILE, N_("FILE"), 0, N_("Read relayed domains from FILE"), GRP+1 }, @@ -1095,10 +1097,6 @@ parse_opt (int key, char *arg, struct argp_state *state) set_option("mailfrom", arg, 1); break; - case OPTION_RETRY: - set_option("retry", arg, 1); - break; - case OPTION_SHOW_DEFAULTS: mode = MAILFROMD_SHOW_DEFAULTS; need_config = 0; |