[dovecot-cvs] dovecot/src/pop3-login client.c, 1.52, 1.53 pop3-proxy.c, 1.10, 1.11

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


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

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



Index: client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/pop3-login/client.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- client.c	6 Aug 2006 20:05:37 -0000	1.52
+++ client.c	10 Aug 2006 21:15:03 -0000	1.53
@@ -73,6 +73,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) {
@@ -227,7 +232,7 @@
 		o_stream_uncork(client->output);
 }
 
-static void client_destroy_oldest(void)
+void client_destroy_oldest(void)
 {
 	struct hash_iterate_context *iter;
 	void *key, *value;
@@ -307,23 +312,8 @@
 			     const struct ip_addr *ip)
 {
 	struct pop3_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: pop3-proxy.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/pop3-login/pop3-proxy.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- pop3-proxy.c	14 Jan 2006 18:48:17 -0000	1.10
+++ pop3-proxy.c	10 Aug 2006 21:15:03 -0000	1.11
@@ -143,6 +143,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