dovecot-2.2: log: Don't spend more than 100 msecs at a time logg...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Feb 7 16:39:17 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/787ce1ab9f85
changeset: 18230:787ce1ab9f85
user: Timo Sirainen <tss at iki.fi>
date: Sat Feb 07 18:23:58 2015 +0200
description:
log: Don't spend more than 100 msecs at a time logging one connection.
diffstat:
src/log/log-connection.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diffs (48 lines):
diff -r 46e28c6ef002 -r 787ce1ab9f85 src/log/log-connection.c
--- a/src/log/log-connection.c Sat Feb 07 18:17:59 2015 +0200
+++ b/src/log/log-connection.c Sat Feb 07 18:23:58 2015 +0200
@@ -6,6 +6,7 @@
#include "istream.h"
#include "llist.h"
#include "hash.h"
+#include "time-util.h"
#include "master-interface.h"
#include "master-service.h"
#include "log-error-buffer.h"
@@ -16,6 +17,7 @@
#include <unistd.h>
#define FATAL_QUEUE_TIMEOUT_MSECS 500
+#define MAX_MSECS_PER_CONNECTION 100
struct log_client {
struct ip_addr ip;
@@ -285,7 +287,7 @@
{
const char *line;
ssize_t ret;
- struct timeval now;
+ struct timeval now, start_timeval;
struct tm tm;
if (!log->handshaked) {
@@ -295,14 +297,18 @@
}
}
+ io_loop_time_refresh();
+ start_timeval = ioloop_timeval;
while ((ret = i_stream_read(log->input)) > 0 || ret == -2) {
/* get new timestamps for every read() */
- io_loop_time_refresh();
now = ioloop_timeval;
tm = *localtime(&now.tv_sec);
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)
+ break;
}
if (log->input->eof)
More information about the dovecot-cvs
mailing list