aboutsummaryrefslogtreecommitdiffstats
path: root/src/kvstorage.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-12-16 18:22:31 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-12-16 18:22:31 +0300
commitb272d240f712e15a93478db124cbf4bd8f7496af (patch)
tree5c39d4c1ff9790fa69a5f45fcf093b63474c3a55 /src/kvstorage.c
parente5c2094331a24c95506764a122ffda88c5998836 (diff)
downloadrspamd-b272d240f712e15a93478db124cbf4bd8f7496af.tar.gz
rspamd-b272d240f712e15a93478db124cbf4bd8f7496af.zip
* Add new plugin ip_score to set and get score for specified ip address.
Diffstat (limited to 'src/kvstorage.c')
-rw-r--r--src/kvstorage.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/kvstorage.c b/src/kvstorage.c
index 4a4585094..76e58adba 100644
--- a/src/kvstorage.c
+++ b/src/kvstorage.c
@@ -343,9 +343,16 @@ rspamd_kv_storage_increment (struct rspamd_kv_storage *storage, gpointer key, gu
lp = &ELT_LONG (elt);
*lp += *value;
*value = *lp;
+ elt->age = time (NULL);
if (storage->backend) {
- g_static_rw_lock_writer_unlock (&storage->rwlock);
- return storage->backend->replace_func (storage->backend, key, keylen, elt);
+ if (storage->backend->replace_func (storage->backend, key, keylen, elt)) {
+ g_static_rw_lock_writer_unlock (&storage->rwlock);
+ return TRUE;
+ }
+ else {
+ g_static_rw_lock_writer_unlock (&storage->rwlock);
+ return FALSE;
+ }
}
else {
g_static_rw_lock_writer_unlock (&storage->rwlock);