]> source.dussan.org Git - rspamd.git/commitdiff
Redis replies can also be strings
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 8 Jan 2016 15:28:32 +0000 (15:28 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 8 Jan 2016 15:28:32 +0000 (15:28 +0000)
src/libstat/backends/redis_backend.c

index cf65d91b04b78241463eea052805c95c6228fc79..8863fb8fed2454783fda2a79bb5699cfa39a0ae3 100644 (file)
@@ -434,6 +434,7 @@ rspamd_redis_processed (redisAsyncContext *c, gpointer r, gpointer priv)
        struct rspamd_task *task;
        rspamd_token_t *tok;
        guint i, processed = 0, found = 0;
+       gulong val;
 
        task = rt->task;
 
@@ -450,6 +451,12 @@ rspamd_redis_processed (redisAsyncContext *c, gpointer r, gpointer priv)
                                                        tok->values[rt->id] = elt->integer;
                                                        found ++;
                                                }
+                                               else if (elt->type == REDIS_REPLY_STRING) {
+                                                       tok = g_ptr_array_index (task->tokens, i);
+                                                       rspamd_strtoul (elt->str, elt->len, &val);
+                                                       tok->values[rt->id] = val;
+                                                       found ++;
+                                               }
                                                else {
                                                        tok->values[rt->id] = 0;
                                                }