[dovecot-cvs] dovecot/src/auth auth-cache.c,1.9,1.10
cras at dovecot.org
cras at dovecot.org
Sat Mar 5 13:57:32 EET 2005
- Previous message: [dovecot-cvs] dovecot/src/auth auth-request-handler.c, 1.3,
1.4 auth-request.c, 1.12, 1.13 auth-request.h, 1.10,
1.11 passdb-blocking.c, 1.1, 1.2 passdb-cache.c, 1.7,
1.8 passdb-cache.h, 1.3, 1.4
- Next message: [dovecot-cvs] dovecot/src/lib-index mail-index.c, 1.188,
1.189 mail-transaction-log-append.c, 1.2,
1.3 mail-transaction-log-view.c, 1.35,
1.36 mail-transaction-log.c, 1.88, 1.89 mail-transaction-log.h,
1.25, 1.26
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv7699
Modified Files:
auth-cache.c
Log Message:
auth_cache_insert(): Don't remove expired nodes just because they're
expired. Before inserting a node, make sure it doesn't already exist (expired).
Index: auth-cache.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-cache.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- auth-cache.c 28 Feb 2005 22:41:33 -0000 1.9
+++ auth-cache.c 5 Mar 2005 11:57:29 -0000 1.10
@@ -167,12 +167,9 @@
const char *key, const char *value)
{
string_t *str;
- time_t now, ttl_time;
struct cache_node *node;
size_t data_size, alloc_size, value_len = strlen(value);
- now = time(NULL);
-
str = t_str_new(256);
var_expand(str, key,
auth_request_get_var_expand_table(request, str_escape));
@@ -180,19 +177,19 @@
data_size = str_len(str) + 1 + value_len + 1;
alloc_size = sizeof(struct cache_node) - sizeof(node->data) + data_size;
- ttl_time = now - cache->ttl_secs;
- while (cache->tail != NULL && cache->tail->created < ttl_time) {
- /* TTL expired, destroy */
- auth_cache_node_destroy(cache, cache->tail);
- }
-
/* make sure we have enough space */
while (cache->size_left < alloc_size)
auth_cache_node_destroy(cache, cache->tail);
+ node = hash_lookup(cache->hash, str_c(str));
+ if (node != NULL) {
+ /* key is already in cache (probably expired), remove it */
+ auth_cache_node_destroy(cache, node);
+ }
+
/* @UNSAFE */
node = i_malloc(alloc_size);
- node->created = now;
+ node->created = time(NULL);
node->alloc_size = alloc_size;
memcpy(node->data, str_data(str), str_len(str));
memcpy(node->data + str_len(str) + 1, value, value_len);
- Previous message: [dovecot-cvs] dovecot/src/auth auth-request-handler.c, 1.3,
1.4 auth-request.c, 1.12, 1.13 auth-request.h, 1.10,
1.11 passdb-blocking.c, 1.1, 1.2 passdb-cache.c, 1.7,
1.8 passdb-cache.h, 1.3, 1.4
- Next message: [dovecot-cvs] dovecot/src/lib-index mail-index.c, 1.188,
1.189 mail-transaction-log-append.c, 1.2,
1.3 mail-transaction-log-view.c, 1.35,
1.36 mail-transaction-log.c, 1.88, 1.89 mail-transaction-log.h,
1.25, 1.26
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list