cvs: php4 /ext/session session.c
| From: | Sascha Schumann | Date: | Wed, 18 Jul 2001 22:56:56 +0000 |
| Subject: | cvs: php4 /ext/session session.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-6260@lists.php.net to get a copy of this message | ||
sas Wed Jul 18 18:56:56 2001 EDT
Modified files:
/php4/ext/session session.c
Log:
Instead of using the poor system rand() algorithm and the
system-time seed, rely on the long-living LCG to determine
whether to start the GC process.
Index: php4/ext/session/session.c
diff -u php4/ext/session/session.c:1.218 php4/ext/session/session.c:1.219
--- php4/ext/session/session.c:1.218 Fri Jul 13 06:32:37 2001
+++ php4/ext/session/session.c Wed Jul 18 18:56:56 2001
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: session.c,v 1.218 2001/07/13 10:32:37 thies Exp $ */
+/* $Id: session.c,v 1.219 2001/07/18 22:56:56 sas Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -911,9 +911,8 @@
if (PS(mod_data) && PS(gc_probability) > 0) {
int nrdels = -1;
- srand(time(NULL));
- nrand = (int) (100.0*rand()/RAND_MAX);
- if (nrand < PS(gc_probability)) {
+ nrand = (int) (100.0*php_combined_lcg());
+ if (nrand <= PS(gc_probability)) {
PS(mod)->gc(&PS(mod_data), PS(gc_maxlifetime), &nrdels);
#if 0
if (nrdels != -1)