dovecot-2.1: lib-master: Another settings parser cache fix
dovecot at dovecot.org
dovecot at dovecot.org
Fri Aug 10 02:33:35 EEST 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/b082b8260782
changeset: 14660:b082b8260782
user: Timo Sirainen <tss at iki.fi>
date: Fri Aug 10 02:33:19 2012 +0300
description:
lib-master: Another settings parser cache fix
diffstat:
src/lib-master/master-service-settings-cache.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diffs (58 lines):
diff -r 82f59d2139a9 -r b082b8260782 src/lib-master/master-service-settings-cache.c
--- a/src/lib-master/master-service-settings-cache.c Wed Aug 08 00:44:27 2012 +0300
+++ b/src/lib-master/master-service-settings-cache.c Fri Aug 10 02:33:19 2012 +0300
@@ -168,10 +168,11 @@
settings_parser_deinit(&entry->parser);
}
-static void cache_add(struct master_service_settings_cache *cache,
- const struct master_service_settings_input *input,
- const struct master_service_settings_output *output,
- struct setting_parser_context *parser)
+static struct setting_parser_context *
+cache_add(struct master_service_settings_cache *cache,
+ const struct master_service_settings_input *input,
+ const struct master_service_settings_output *output,
+ struct setting_parser_context *parser)
{
struct settings_entry *entry;
pool_t pool;
@@ -187,17 +188,17 @@
}
if (cache->service_uses_remote) {
/* for now we don't try to handle caching remote IPs */
- return;
+ return parser;
}
if (input->local_name == NULL && input->local_ip.family == 0)
- return;
+ return parser;
if (!output->used_local) {
/* use global settings, but add local_ip/host to hash tables
so we'll find them */
pool = pool_alloconly_create("settings global entry", 256);
- } else if (cache->cache_malloc_size >= cache->max_cache_size) {
+ } else if (cache->cache_malloc_size >= /*cache->max_cache_size*/1) {
/* free the oldest and reuse its pool */
pool = cache->oldest->pool;
setting_entry_detach(cache, cache->oldest);
@@ -249,6 +250,7 @@
hash_table_insert(cache->local_ip_hash,
&entry->local_ip, entry);
}
+ return entry->parser;
}
int master_service_settings_cache_read(struct master_service_settings_cache *cache,
@@ -294,7 +296,7 @@
return -1;
}
- cache_add(cache, &new_input, &output, cache->service->set_parser);
- *parser_r = cache->service->set_parser;
+ *parser_r = cache_add(cache, &new_input, &output,
+ cache->service->set_parser);
return 0;
}
More information about the dovecot-cvs
mailing list