Move session table initialization into session file.
This moves all the code working on the session table to that file.
This commit is contained in:
parent
392863c733
commit
d29de0b818
|
@ -329,6 +329,7 @@ void am_cookie_set(request_rec *r, const char *id);
|
|||
void am_cookie_delete(request_rec *r);
|
||||
|
||||
|
||||
void am_cache_init(am_mod_cfg_rec *mod_cfg);
|
||||
am_cache_entry_t *am_cache_lock(server_rec *s,
|
||||
am_cache_key_t type, const char *key);
|
||||
const char *am_cache_entry_get_string(am_cache_entry_t *e,
|
||||
|
|
|
@ -21,6 +21,26 @@
|
|||
|
||||
#include "auth_mellon.h"
|
||||
|
||||
/* Initialize the session table.
|
||||
*
|
||||
* Parameters:
|
||||
* am_mod_cfg_rec *mod_cfg The module configuration.
|
||||
*
|
||||
* Returns:
|
||||
* Nothing.
|
||||
*/
|
||||
void am_cache_init(am_mod_cfg_rec *mod_cfg)
|
||||
{
|
||||
am_cache_entry_t *table;
|
||||
int i;
|
||||
/* Initialize the session table. */
|
||||
table = apr_shm_baseaddr_get(mod_cfg->cache);
|
||||
for (i = 0; i < mod_cfg->cache_size; i++) {
|
||||
table[i].key[0] = '\0';
|
||||
table[i].access = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* This function locks the session table and locates a session entry.
|
||||
* Unlocks the table and returns NULL if the entry wasn't found.
|
||||
* If a entry was found, then you _must_ unlock it with am_cache_unlock
|
||||
|
|
|
@ -45,10 +45,9 @@
|
|||
static int am_global_init(apr_pool_t *conf, apr_pool_t *log,
|
||||
apr_pool_t *tmp, server_rec *s)
|
||||
{
|
||||
am_cache_entry_t *table;
|
||||
apr_size_t mem_size;
|
||||
am_mod_cfg_rec *mod;
|
||||
int rv, i;
|
||||
int rv;
|
||||
const char userdata_key[] = "auth_mellon_init";
|
||||
char buffer[512];
|
||||
void *data;
|
||||
|
@ -108,11 +107,7 @@ static int am_global_init(apr_pool_t *conf, apr_pool_t *log,
|
|||
}
|
||||
|
||||
/* Initialize the session table. */
|
||||
table = apr_shm_baseaddr_get(mod->cache);
|
||||
for (i = 0; i < mod->cache_size; i++) {
|
||||
table[i].key[0] = '\0';
|
||||
table[i].access = 0;
|
||||
}
|
||||
am_cache_init(mod);
|
||||
|
||||
/* Now create the mutex that we need for locking the shared memory, then
|
||||
* test for success. we really need this, so we exit on failure. */
|
||||
|
|
Loading…
Reference in New Issue