dovecot-2.0: "dovecot stop" now waits for up to 3 seconds for ma...

dovecot at dovecot.org dovecot at dovecot.org
Sat Mar 6 12:30:57 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/a81aceb9f55b
changeset: 10842:a81aceb9f55b
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Mar 06 12:30:53 2010 +0200
description:
"dovecot stop" now waits for up to 3 seconds for master to actually die.

diffstat:

 src/master/main.c |  14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diffs (31 lines):

diff -r 1a76670bb50e -r a81aceb9f55b src/master/main.c
--- a/src/master/main.c	Sat Mar 06 12:26:10 2010 +0200
+++ b/src/master/main.c	Sat Mar 06 12:30:53 2010 +0200
@@ -249,6 +249,7 @@
 
 static void send_master_signal(int signo)
 {
+	unsigned int i;
 	pid_t pid;
 
 	if (!pid_file_read(pidfile_path, &pid)) {
@@ -258,6 +259,19 @@
 
 	if (kill(pid, signo) < 0)
 		i_fatal("kill(%s, %d) failed: %m", dec2str(pid), signo);
+
+	if (signo == SIGTERM) {
+		/* wait for a while for the process to die */
+		usleep(1000);
+		for (i = 0; i < 30; i++) {
+			if (kill(pid, 0) < 0) {
+				if (errno != ESRCH)
+					i_error("kill() failed: %m");
+				break;
+			}
+			usleep(100000);
+		}
+	}
 	exit(0);
 }
 


More information about the dovecot-cvs mailing list