aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-06-17 13:18:01 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-06-17 13:18:01 +0100
commit2463093c9d11f897cbc96120930b41be6cacfbf3 (patch)
tree90f119add6bfd13b7686349f38d92c90eb9e8cc5 /src/libstat
parent50dba2f90e07efeed5c7ad2c0066a181e330065f (diff)
downloadrspamd-2463093c9d11f897cbc96120930b41be6cacfbf3.tar.gz
rspamd-2463093c9d11f897cbc96120930b41be6cacfbf3.zip
[Fix] Try to avoid recursive events deletions
Diffstat (limited to 'src/libstat')
-rw-r--r--src/libstat/backends/redis_backend.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c
index c0d54325e..e83fc3e46 100644
--- a/src/libstat/backends/redis_backend.c
+++ b/src/libstat/backends/redis_backend.c
@@ -853,10 +853,15 @@ rspamd_redis_processed (redisAsyncContext *c, gpointer r, gpointer priv)
else {
msg_err_task ("error getting reply from redis server %s: %s",
rspamd_upstream_name (rt->selected), c->errstr);
- rspamd_upstream_fail (rt->selected);
+
+ if (rt->redis) {
+ rspamd_upstream_fail (rt->selected);
+ }
}
- rspamd_session_remove_event (task->s, rspamd_redis_fin, rt);
+ if (rt->redis) {
+ rspamd_session_remove_event (task->s, rspamd_redis_fin, rt);
+ }
}
/* Called when we have set tokens during learning */
@@ -870,12 +875,17 @@ rspamd_redis_learned (redisAsyncContext *c, gpointer r, gpointer priv)
if (c->err == 0) {
rspamd_upstream_ok (rt->selected);
- rspamd_session_remove_event (task->s, rspamd_redis_fin_learn, rt);
}
else {
msg_err_task_check ("error getting reply from redis server %s: %s",
rspamd_upstream_name (rt->selected), c->errstr);
- rspamd_upstream_fail (rt->selected);
+
+ if (rt->redis) {
+ rspamd_upstream_fail (rt->selected);
+ }
+ }
+
+ if (rt->redis) {
rspamd_session_remove_event (task->s, rspamd_redis_fin_learn, rt);
}
}