changeset 2775:e6e73d1db27c HEAD

Log flushing fixes.
author Timo Sirainen <tss@iki.fi>
date Tue, 19 Oct 2004 03:42:07 +0300
parents 689e4235681f
children 150f8151c971
files src/master/log.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/master/log.c	Tue Oct 19 02:08:02 2004 +0300
+++ b/src/master/log.c	Tue Oct 19 03:42:07 2004 +0300
@@ -21,6 +21,7 @@
 	char *prefix;
 	char next_log_type;
 	unsigned int throttle_msg:1;
+	unsigned int destroying:1;
 };
 
 static struct log_io *log_ios;
@@ -113,7 +114,8 @@
 	if (!continues)
 		log_io->next_log_type = '\0';
 
-	if (++log_io->log_counter > MAX_LOG_MESSAGS_PER_SEC) {
+	if (++log_io->log_counter > MAX_LOG_MESSAGS_PER_SEC &&
+	    !log_io->destroying) {
 		log_throttle(log_io);
 		return 0;
 	}
@@ -196,6 +198,10 @@
 	size_t size;
 
 	/* if there was something in buffer, write it */
+	log_io->destroying = TRUE;
+	(void)log_write_pending(log_io);
+
+	/* write partial data as well */
 	data = i_stream_get_data(log_io->stream, &size);
 	if (size != 0) {
 		t_push();