dovecot-2.0: lib-master: If accept() fails and there are no clie...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Aug 24 18:39:02 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/41188b7db88a
changeset: 9807:41188b7db88a
user: Timo Sirainen <tss at iki.fi>
date: Mon Aug 24 11:38:56 2009 -0400
description:
lib-master: If accept() fails and there are no clients, die instead of waiting forever.
diffstat:
1 file changed, 19 insertions(+), 14 deletions(-)
src/lib-master/master-service.c | 33 +++++++++++++++++++--------------
diffs (55 lines):
diff -r 3c33f864b4ae -r 41188b7db88a src/lib-master/master-service.c
--- a/src/lib-master/master-service.c Mon Aug 17 14:18:52 2009 -0400
+++ b/src/lib-master/master-service.c Mon Aug 24 11:38:56 2009 -0400
@@ -212,24 +212,29 @@ bool master_service_parse_option(struct
return TRUE;
}
-static void master_status_error(void *context)
-{
- struct master_service *service = context;
-
- /* status fd is a write-only pipe, so if we're here it means the
- master wants us to die (or died itself). don't die until all
- service connections are finished. */
- io_remove(&service->io_status_error);
-
- /* the log fd may also be closed already, don't die when trying to
- log later */
- i_set_failure_ignore_errors(TRUE);
-
+static void master_service_error(struct master_service *service)
+{
if (service->master_status.available_count ==
service->total_available_count)
master_service_stop(service);
else
io_listeners_remove(service);
+}
+
+static void master_status_error(void *context)
+{
+ struct master_service *service = context;
+
+ /* status fd is a write-only pipe, so if we're here it means the
+ master wants us to die (or died itself). don't die until all
+ service connections are finished. */
+ io_remove(&service->io_status_error);
+
+ /* the log fd may also be closed already, don't die when trying to
+ log later */
+ i_set_failure_ignore_errors(TRUE);
+
+ master_service_error(service);
}
void master_service_init_finish(struct master_service *service)
@@ -482,7 +487,7 @@ static void master_service_listen(struct
if (errno != ENOTSOCK) {
i_error("net_accept() failed: %m");
- io_listeners_remove(l->service);
+ master_service_error(l->service);
return;
}
/* it's not a socket. probably a fifo. use the "listener"
More information about the dovecot-cvs
mailing list