sas             Thu Oct  3 02:45:15 2002 EDT

  Modified files:              
    /php4/ext/session   php_session.h session.c 
  Log:
  Make the interpretation of gc_probability configurable by adding
  session.gc_dividend. The probability of running gc on each request is then
  gc_probability/gc_dividend.
  
  
Index: php4/ext/session/php_session.h
diff -u php4/ext/session/php_session.h:1.83 php4/ext/session/php_session.h:1.84
--- php4/ext/session/php_session.h:1.83 Wed Oct  2 23:23:02 2002
+++ php4/ext/session/php_session.h      Thu Oct  3 02:45:15 2002
@@ -105,6 +105,7 @@
        void *mod_data;
        php_session_status session_status;
        long gc_probability;
+       long gc_dividend;
        long gc_maxlifetime;
        int module_number;
        long cache_expire;
Index: php4/ext/session/session.c
diff -u php4/ext/session/session.c:1.328 php4/ext/session/session.c:1.329
--- php4/ext/session/session.c:1.328    Thu Oct  3 02:29:58 2002
+++ php4/ext/session/session.c  Thu Oct  3 02:45:15 2002
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: session.c,v 1.328 2002/10/03 06:29:58 sas Exp $ */
+/* $Id: session.c,v 1.329 2002/10/03 06:45:15 sas Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -128,6 +128,7 @@
        PHP_INI_ENTRY("session.save_handler",           "files",     PHP_INI_ALL, 
OnUpdateSaveHandler)
        STD_PHP_INI_BOOLEAN("session.auto_start",       "0",         PHP_INI_ALL, 
OnUpdateBool,   auto_start,         php_ps_globals,    ps_globals)
        STD_PHP_INI_ENTRY("session.gc_probability",     "1",         PHP_INI_ALL, 
OnUpdateInt,    gc_probability,     php_ps_globals,    ps_globals)
+       STD_PHP_INI_ENTRY("session.gc_dividend",        "100",       PHP_INI_ALL, 
+OnUpdateInt,    gc_dividend,        php_ps_globals,    ps_globals)
        STD_PHP_INI_ENTRY("session.gc_maxlifetime",     "1440",      PHP_INI_ALL, 
OnUpdateInt,    gc_maxlifetime,     php_ps_globals,    ps_globals)
        PHP_INI_ENTRY("session.serialize_handler",      "php",       PHP_INI_ALL, 
OnUpdateSerializer)
        STD_PHP_INI_ENTRY("session.cookie_lifetime",    "0",         PHP_INI_ALL, 
OnUpdateInt,    cookie_lifetime,    php_ps_globals,    ps_globals)
@@ -1035,7 +1036,7 @@
        if (PS(mod_data) && PS(gc_probability) > 0) {
                int nrdels = -1;
 
-               nrand = (int) (100.0*php_combined_lcg(TSRMLS_C));
+               nrand = (int) ((float) PS(gc_dividend) * php_combined_lcg(TSRMLS_C));
                if (nrand < PS(gc_probability)) {
                        PS(mod)->gc(&PS(mod_data), PS(gc_maxlifetime), &nrdels 
TSRMLS_CC);
 #if 0



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to