dovecot-2.2: lib-master: If config socket closes, retry connecti...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Aug 1 13:52:12 EEST 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/96ea65bf653c
changeset: 16628:96ea65bf653c
user: Timo Sirainen <tss at iki.fi>
date: Thu Aug 01 13:51:57 2013 +0300
description:
lib-master: If config socket closes, retry connecting to it automatically.
diffstat:
src/lib-master/master-service-settings.c | 25 +++++++++++++++++--------
1 files changed, 17 insertions(+), 8 deletions(-)
diffs (41 lines):
diff -r eb63eca74471 -r 96ea65bf653c src/lib-master/master-service-settings.c
--- a/src/lib-master/master-service-settings.c Thu Aug 01 13:42:51 2013 +0300
+++ b/src/lib-master/master-service-settings.c Thu Aug 01 13:51:57 2013 +0300
@@ -367,20 +367,29 @@
unsigned int i;
int ret, fd = -1;
time_t now, timeout;
- bool use_environment;
+ bool use_environment, retry;
memset(output_r, 0, sizeof(*output_r));
if (getenv("DOVECONF_ENV") == NULL &&
(service->flags & MASTER_SERVICE_FLAG_NO_CONFIG_SETTINGS) == 0) {
- fd = master_service_open_config(service, input, &path, error_r);
- if (fd == -1)
- return -1;
+ retry = service->config_fd != -1;
+ for (;;) {
+ fd = master_service_open_config(service, input,
+ &path, error_r);
+ if (fd == -1)
+ return -1;
- if (config_send_request(service, input, fd, path, error_r) < 0) {
- i_close_fd(&fd);
- config_exec_fallback(service, input);
- return -1;
+ if (config_send_request(service, input, fd,
+ path, error_r) == 0)
+ break;
+ if (!retry) {
+ i_close_fd(&fd);
+ config_exec_fallback(service, input);
+ return -1;
+ }
+ /* config process died, retry connecting */
+ retry = FALSE;
}
}
More information about the dovecot-cvs
mailing list