Ted Felix schrieb:
>  If you don't mind grabbing the code and building it, you can go into
> the file connection_list.c and change this line:
> 
> #define MAX_CONNECTIONS 10
> 
>  To this:
> 
> #define MAX_CONNECTIONS 20
> 
>  That will get rid of the "Too many connections." message in the log. 
> Whether it will solve your problem, I'm not sure.  I will include this
> change in my next monthly release on 2/15.  Let me know if you need more
> info.

I've just found a more reliable way to reproduce this problem: Simply
switch 10 times between the X session and a console.

However, changing MAX_CONNECTIONS to 20 solves the problem - I tried to
switch more than 20 times and the problem did not reappear.

Attached is a patch that, apart from changing MAX_CONNECTIONS,
recalculates highestfd in delete_connection. I wrote that patch because
I first thought that this might be the source of the problem, but it
isn't. But it might be useful anyway.

WM
--- acpid-2.0.1.orig/connection_list.c
+++ acpid-2.0.1/connection_list.c
@@ -32,7 +32,7 @@
 /*---------------------------------------------------------------*/
 /* private objects */
 
-#define MAX_CONNECTIONS 10
+#define MAX_CONNECTIONS 20
 
 static struct connection connection_list[MAX_CONNECTIONS];
 
@@ -92,8 +92,15 @@
 			break;
 		}
 	}
+
+	/* prepare for recalculation of highestfd */
+	highestfd = -2;
 	
-	/* ??? might be nice to re-evaluate highestfd */
+	/* recalculate highestfd */
+	for (i = 0; i < nconnections; ++i) {
+		highestfd = max(highestfd, connection_list[i].fd);
+	}
+
 }
 
 /*---------------------------------------------------------------*/

Reply via email to