[dovecot-cvs] dovecot/src/master auth-process.c, 1.75, 1.76 log.c, 1.3, 1.4 log.h, 1.2, 1.3 login-process.c, 1.62, 1.63 mail-process.c, 1.68, 1.69

cras at dovecot.org cras at dovecot.org
Sun Jan 9 22:12:38 EET 2005


Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv1210

Modified Files:
	auth-process.c log.c log.h login-process.c mail-process.c 
Log Message:
Disable log throttlong for auth process, and for login processes if
login_process_per_connection=no.



Index: auth-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/auth-process.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- auth-process.c	9 Jan 2005 19:09:57 -0000	1.75
+++ auth-process.c	9 Jan 2005 20:12:35 -0000	1.76
@@ -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 {

Index: log.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/log.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- log.c	19 Oct 2004 00:42:07 -0000	1.3
+++ log.c	9 Jan 2005 20:12:35 -0000	1.4
@@ -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);

Index: log.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/log.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- log.h	23 May 2004 19:23:57 -0000	1.2
+++ log.h	9 Jan 2005 20:12:35 -0000	1.3
@@ -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);

Index: login-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/login-process.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- login-process.c	24 Nov 2004 16:44:11 -0000	1.62
+++ login-process.c	9 Jan 2005 20:12:35 -0000	1.63
@@ -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 {

Index: mail-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/mail-process.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- mail-process.c	29 Dec 2004 19:10:27 -0000	1.68
+++ mail-process.c	9 Jan 2005 20:12:35 -0000	1.69
@@ -344,7 +344,7 @@
 		return FALSE;
 	}
 
-	log_fd = log_create_pipe(&log);
+	log_fd = log_create_pipe(&log, 10);
 
 	pid = fork();
 	if (pid < 0) {



More information about the dovecot-cvs mailing list