[dovecot-cvs] dovecot/src/imap-login client.c, 1.51.2.2, 1.51.2.3 imap-proxy.c, 1.7, 1.7.2.1

cras at dovecot.org cras at dovecot.org
Fri Aug 11 00:14:56 EEST 2006


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

Modified Files:
      Tag: branch_1_0
	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.51.2.2
retrieving revision 1.51.2.3
diff -u -d -r1.51.2.2 -r1.51.2.3
--- client.c	6 Aug 2006 20:05:23 -0000	1.51.2.2
+++ client.c	10 Aug 2006 21:14:53 -0000	1.51.2.3
@@ -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.7.2.1
diff -u -d -r1.7 -r1.7.2.1
--- imap-proxy.c	14 Jan 2006 18:47:22 -0000	1.7
+++ imap-proxy.c	10 Aug 2006 21:14:53 -0000	1.7.2.1
@@ -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