[dovecot-cvs] dovecot/src/imap-login client.c, 1.53, 1.54 imap-proxy.c, 1.7, 1.8

cras at dovecot.org cras at dovecot.org
Fri Aug 11 00:15:06 EEST 2006


Update of /var/lib/cvs/dovecot/src/imap-login
In directory talvi:/tmp/cvs-serv17141/imap-login

Modified Files:
	client.c imap-proxy.c 
Log Message:
Fixes for handling near-full connection queues.



Index: client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap-login/client.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- client.c	6 Aug 2006 20:05:35 -0000	1.53
+++ client.c	10 Aug 2006 21:15:02 -0000	1.54
@@ -117,6 +117,11 @@
 {
 	int fd_ssl;
 
+	client_ref(client);
+	connection_queue_add(1);
+	if (!client_unref(client))
+		return;
+
 	fd_ssl = ssl_proxy_new(client->common.fd, &client->common.ip,
 			       &client->common.proxy);
 	if (fd_ssl == -1) {
@@ -354,7 +359,7 @@
 	client_unref(client);
 }
 
-static void client_destroy_oldest(void)
+void client_destroy_oldest(void)
 {
 	struct hash_iterate_context *iter;
 	void *key, *value;
@@ -414,23 +419,8 @@
 			     const struct ip_addr *ip)
 {
 	struct imap_client *client;
-	unsigned int current_count;
 
-	if (!process_per_connection) {
-		current_count = hash_size(clients) +
-			ssl_proxy_get_count() + login_proxy_get_count();
-		if (current_count >= max_connections) {
-			/* already reached max. users count, kill few of the
-			   oldest connections. this happens when we've maxed
-			   out the login process count also. */
-			client_destroy_oldest();
-		}
-		if (current_count + 1 >= max_connections) {
-			/* after this client we've reached max users count,
-			   so stop listening for more */
-			main_listen_stop();
-		}
-	}
+	connection_queue_add(1);
 
 	/* always use nonblocking I/O */
 	net_set_nonblock(fd, TRUE);

Index: imap-proxy.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap-login/imap-proxy.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- imap-proxy.c	14 Jan 2006 18:47:22 -0000	1.7
+++ imap-proxy.c	10 Aug 2006 21:15:02 -0000	1.8
@@ -129,6 +129,9 @@
 		return -1;
 	}
 
+	i_assert(client->refcount > 1);
+	connection_queue_add(1);
+
 	client->proxy = login_proxy_new(&client->common, host, port,
 					proxy_input, client);
 	if (client->proxy == NULL)



More information about the dovecot-cvs mailing list