[dovecot-cvs] dovecot/src/login-common client-common.h, 1.9, 1.9.2.1 common.h, 1.10.2.1, 1.10.2.2 main.c, 1.33.2.3, 1.33.2.4
cras at dovecot.org
cras at dovecot.org
Fri Aug 11 00:14:55 EEST 2006
Update of /var/lib/cvs/dovecot/src/login-common
In directory talvi:/tmp/cvs-serv1511/login-common
Modified Files:
Tag: branch_1_0
client-common.h common.h main.c
Log Message:
Fixes for handling near-full connection queues.
Index: client-common.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/login-common/client-common.h,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -u -d -r1.9 -r1.9.2.1
--- client-common.h 13 Jan 2006 20:26:39 -0000 1.9
+++ client-common.h 10 Aug 2006 21:14:52 -0000 1.9.2.1
@@ -33,6 +33,7 @@
unsigned int clients_get_count(void);
void clients_notify_auth_connected(void);
+void client_destroy_oldest(void);
void clients_destroy_all(void);
void clients_init(void);
Index: common.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/login-common/common.h,v
retrieving revision 1.10.2.1
retrieving revision 1.10.2.2
diff -u -d -r1.10.2.1 -r1.10.2.2
--- common.h 6 Aug 2006 20:05:24 -0000 1.10.2.1
+++ common.h 10 Aug 2006 21:14:52 -0000 1.10.2.2
@@ -27,4 +27,6 @@
void main_listen_start(void);
void main_listen_stop(void);
+void connection_queue_add(unsigned int connection_count);
+
#endif
Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/login-common/main.c,v
retrieving revision 1.33.2.3
retrieving revision 1.33.2.4
diff -u -d -r1.33.2.3 -r1.33.2.4
--- main.c 10 Aug 2006 18:46:20 -0000 1.33.2.3
+++ main.c 10 Aug 2006 21:14:52 -0000 1.33.2.4
@@ -184,6 +184,33 @@
LOGIN_STATE_FULL_PRELOGINS);
}
+void connection_queue_add(unsigned int connection_count)
+{
+ unsigned int current_count;
+
+ if (process_per_connection)
+ return;
+
+ current_count = clients_get_count() + ssl_proxy_get_count() +
+ login_proxy_get_count();
+ if (current_count + connection_count + 1 >= max_connections) {
+ /* after this client we've reached max users count,
+ so stop listening for more. reserve +1 extra for SSL
+ connections. */
+ main_listen_stop();
+
+ 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 and master has told us to start listening for
+ new connections even though we're full. */
+ client_destroy_oldest();
+ }
+ }
+}
+
static void auth_connect_notify(struct auth_client *client __attr_unused__,
bool connected, void *context __attr_unused__)
{
More information about the dovecot-cvs
mailing list