changeset 18485:211099aefe77

log: Don't confuse process sending a partial log line to process sending logs too fast. If it's a partial line we don't want to show the "service too fast" error in ps title.
author Timo Sirainen <tss@iki.fi>
date Sat, 25 Apr 2015 12:07:44 +0300
parents 1b3224f0135f
children a2d342257b25
files src/log/log-connection.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/log/log-connection.c	Sat Apr 25 11:52:02 2015 +0300
+++ b/src/log/log-connection.c	Sat Apr 25 12:07:44 2015 +0300
@@ -326,6 +326,7 @@
 	ssize_t ret;
 	struct timeval now, start_timeval;
 	struct tm tm;
+	bool too_much = FALSE;
 
 	if (!log->handshaked) {
 		if (log_connection_handshake(log) < 0) {
@@ -344,8 +345,10 @@
 		while ((line = i_stream_next_line(log->input)) != NULL)
 			log_it(log, line, &now, &tm);
 		io_loop_time_refresh();
-		if (timeval_diff_msecs(&ioloop_timeval, &start_timeval) > MAX_MSECS_PER_CONNECTION)
+		if (timeval_diff_msecs(&ioloop_timeval, &start_timeval) > MAX_MSECS_PER_CONNECTION) {
+			too_much = TRUE;
 			break;
+		}
 	}
 
 	if (log->input->eof)
@@ -355,7 +358,7 @@
 		log_connection_destroy(log);
 	} else {
 		i_assert(!log->input->closed);
-		if (ret == 0) {
+		if (!too_much) {
 			if (log->pending_count > 0) {
 				log->pending_count = 0;
 				i_assert(global_pending_count > 0);