Mercurial > dovecot > original-hg > dovecot-1.2
changeset 3083:a20882c4f092 HEAD
Disable log throttlong for auth process, and for login processes if
login_process_per_connection=no.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 09 Jan 2005 22:12:35 +0200 |
parents | 620a00db2c7c |
children | 873ce1b9747e |
files | src/master/auth-process.c src/master/log.c src/master/log.h src/master/login-process.c src/master/mail-process.c |
diffstat | 5 files changed, 13 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/master/auth-process.c Sun Jan 09 21:56:00 2005 +0200 +++ b/src/master/auth-process.c Sun Jan 09 22:12:35 2005 +0200 @@ -412,7 +412,7 @@ return -1; } - log_fd = log_create_pipe(&log); + log_fd = log_create_pipe(&log, 0); if (log_fd < 0) pid = -1; else {
--- a/src/master/log.c Sun Jan 09 21:56:00 2005 +0200 +++ b/src/master/log.c Sun Jan 09 22:12:35 2005 +0200 @@ -8,8 +8,6 @@ #include <unistd.h> -#define MAX_LOG_MESSAGS_PER_SEC 10 - struct log_io { struct log_io *prev, *next; struct io *io; @@ -17,6 +15,7 @@ time_t log_stamp; unsigned int log_counter; + unsigned int max_lines_per_sec; char *prefix; char next_log_type; @@ -114,7 +113,7 @@ if (!continues) log_io->next_log_type = '\0'; - if (++log_io->log_counter > MAX_LOG_MESSAGS_PER_SEC && + if (++log_io->log_counter > log_io->max_lines_per_sec && !log_io->destroying) { log_throttle(log_io); return 0; @@ -153,11 +152,11 @@ if (!log_write_pending(log_io)) return; - if (log_io->log_counter < MAX_LOG_MESSAGS_PER_SEC) + if (log_io->log_counter < log_io->max_lines_per_sec) log_unthrottle(log_io); } -int log_create_pipe(struct log_io **log_r) +int log_create_pipe(struct log_io **log_r, unsigned int max_lines_per_sec) { struct log_io *log_io; int fd[2]; @@ -172,6 +171,8 @@ log_io = i_new(struct log_io, 1); log_io->stream = i_stream_create_file(fd[0], default_pool, 1024, TRUE); + log_io->max_lines_per_sec = + max_lines_per_sec != 0 ? max_lines_per_sec : (unsigned int)-1; throttle_count++; log_unthrottle(log_io);
--- a/src/master/log.h Sun Jan 09 21:56:00 2005 +0200 +++ b/src/master/log.h Sun Jan 09 22:12:35 2005 +0200 @@ -3,7 +3,7 @@ struct log_io; -int log_create_pipe(struct log_io **log_r); +int log_create_pipe(struct log_io **log_r, unsigned int max_lines_per_sec); void log_set_prefix(struct log_io *log, const char *prefix); void log_init(void);
--- a/src/master/login-process.c Sun Jan 09 21:56:00 2005 +0200 +++ b/src/master/login-process.c Sun Jan 09 22:12:35 2005 +0200 @@ -446,6 +446,7 @@ static pid_t create_login_process(struct login_group *group) { struct log_io *log; + unsigned int max_log_lines_per_sec; const char *prefix; pid_t pid; int fd[2], log_fd; @@ -466,7 +467,9 @@ return -1; } - log_fd = log_create_pipe(&log); + max_log_lines_per_sec = + group->set->login_process_per_connection ? 10 : 0; + log_fd = log_create_pipe(&log, max_log_lines_per_sec); if (log_fd < 0) pid = -1; else {