[pkg-fso-commits] [SCM] Automatic Display Manager branch, master, updated. debian/0.1-52-g76526e2

Enrico Zini enrico at enricozini.org
Mon Feb 23 18:02:47 UTC 2009


The following commit has been merged in the master branch:
commit f5cafedc99c474cec85b8f766912c1f36679745b
Author: Enrico Zini <enrico at enricozini.org>
Date:   Mon Feb 16 18:56:36 2009 +0000

    Smarter retry times

diff --git a/TODO b/TODO
index f716d3f..825ef39 100644
--- a/TODO
+++ b/TODO
@@ -1 +1,6 @@
- * Write a binary, repacing "su -l" with it’s own pam configuration name
+ + Write a binary, repacing "su -l" with it’s own pam configuration name
+ - configure via preseeding
+ + create a hand-crafted array of sleep times instead of using an
+   exponential increase.  This is to avoid silly steps like "2, 4, 8"
+   and have something more meaningful instead like "0, 0, 30, 30, 60, 60"
+ - log when the session is restarted
diff --git a/nodm.c b/nodm.c
index e5568f4..31b5f80 100644
--- a/nodm.c
+++ b/nodm.c
@@ -285,6 +285,7 @@ static int run_shell (int* status)
 
 void run_session()
 {
+	static int retry_times[] = { 0, 0, 30, 30, 60, 60, -1 };
 	int restart_count = 0;
 	char* s_mst = getenv("NODM_MIN_SESSION_TIME");
 	int mst = s_mst ? atoi(s_mst) : 60;
@@ -302,14 +303,14 @@ void run_session()
 		/* Check if the session was too short */
 		if (end - begin > mst)
 		{
-			if (restart_count < 6)
+			if (retry_times[restart_count+1] != -1)
 				++restart_count;
 		}
 		else
 			restart_count = 0;
 
 		/* Sleep a bit if the session was too short */
-		sleep(1 << restart_count);
+		sleep(retry_times[restart_count]);
 	}
 }
 

-- 
Automatic Display Manager



More information about the pkg-fso-commits mailing list