diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-09-13 11:05:24 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-09-13 11:05:24 +0100 |
commit | 1f5d779be8d7da0cd0fe02aa9f1670167c9ab58f (patch) | |
tree | a032dbb6f26a53cbbb1eb61d1dbf1aa4a05d9737 /src/libserver/fuzzy_backend/fuzzy_backend_redis.c | |
parent | 353f62ee741e7f9debf5c050152613cc1de1aa28 (diff) | |
download | rspamd-1f5d779be8d7da0cd0fe02aa9f1670167c9ab58f.tar.gz rspamd-1f5d779be8d7da0cd0fe02aa9f1670167c9ab58f.zip |
[Minor] Fix redis termination case not being caught by fuzzy redis
Diffstat (limited to 'src/libserver/fuzzy_backend/fuzzy_backend_redis.c')
-rw-r--r-- | src/libserver/fuzzy_backend/fuzzy_backend_redis.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/libserver/fuzzy_backend/fuzzy_backend_redis.c b/src/libserver/fuzzy_backend/fuzzy_backend_redis.c index f16040d8f..75bb005d7 100644 --- a/src/libserver/fuzzy_backend/fuzzy_backend_redis.c +++ b/src/libserver/fuzzy_backend/fuzzy_backend_redis.c @@ -341,7 +341,7 @@ rspamd_fuzzy_redis_shingles_callback (redisAsyncContext *c, gpointer r, ev_timer_stop (session->event_loop, &session->timeout); memset (&rep, 0, sizeof (rep)); - if (c->err == 0) { + if (c->err == 0 && reply != NULL) { rspamd_upstream_ok (session->up); if (reply->type == REDIS_REPLY_ARRAY && @@ -462,9 +462,8 @@ rspamd_fuzzy_redis_shingles_callback (redisAsyncContext *c, gpointer r, if (c->errstr) { msg_err_redis_session ("error getting shingles: %s", c->errstr); + rspamd_upstream_fail (session->up, FALSE, c->errstr); } - - rspamd_upstream_fail (session->up, FALSE, strerror (errno)); } rspamd_fuzzy_redis_session_dtor (session, FALSE); @@ -541,7 +540,7 @@ rspamd_fuzzy_redis_check_callback (redisAsyncContext *c, gpointer r, ev_timer_stop (session->event_loop, &session->timeout); memset (&rep, 0, sizeof (rep)); - if (c->err == 0) { + if (c->err == 0 && reply != NULL) { rspamd_upstream_ok (session->up); if (reply->type == REDIS_REPLY_ARRAY && reply->elements >= 2) { @@ -609,9 +608,8 @@ rspamd_fuzzy_redis_check_callback (redisAsyncContext *c, gpointer r, msg_err_redis_session ("error getting hashes on %s: %s", rspamd_inet_address_to_string_pretty (rspamd_upstream_addr_cur (session->up)), c->errstr); + rspamd_upstream_fail (session->up, FALSE, c->errstr); } - - rspamd_upstream_fail (session->up, FALSE, strerror (errno)); } rspamd_fuzzy_redis_session_dtor (session, FALSE); @@ -730,7 +728,7 @@ rspamd_fuzzy_redis_count_callback (redisAsyncContext *c, gpointer r, ev_timer_stop (session->event_loop, &session->timeout); - if (c->err == 0) { + if (c->err == 0 && reply != NULL) { rspamd_upstream_ok (session->up); if (reply->type == REDIS_REPLY_INTEGER) { @@ -764,9 +762,9 @@ rspamd_fuzzy_redis_count_callback (redisAsyncContext *c, gpointer r, msg_err_redis_session ("error getting count on %s: %s", rspamd_inet_address_to_string_pretty (rspamd_upstream_addr_cur (session->up)), c->errstr); + rspamd_upstream_fail (session->up, FALSE, c->errstr); } - rspamd_upstream_fail (session->up, FALSE, strerror (errno)); } rspamd_fuzzy_redis_session_dtor (session, FALSE); @@ -868,7 +866,7 @@ rspamd_fuzzy_redis_version_callback (redisAsyncContext *c, gpointer r, ev_timer_stop (session->event_loop, &session->timeout); - if (c->err == 0) { + if (c->err == 0 && reply != NULL) { rspamd_upstream_ok (session->up); if (reply->type == REDIS_REPLY_INTEGER) { @@ -902,9 +900,8 @@ rspamd_fuzzy_redis_version_callback (redisAsyncContext *c, gpointer r, msg_err_redis_session ("error getting version on %s: %s", rspamd_inet_address_to_string_pretty (rspamd_upstream_addr_cur (session->up)), c->errstr); + rspamd_upstream_fail (session->up, FALSE, c->errstr); } - - rspamd_upstream_fail (session->up, FALSE, strerror (errno)); } rspamd_fuzzy_redis_session_dtor (session, FALSE); @@ -1374,7 +1371,7 @@ rspamd_fuzzy_redis_update_callback (redisAsyncContext *c, gpointer r, ev_timer_stop (session->event_loop, &session->timeout); - if (c->err == 0) { + if (c->err == 0 && reply != NULL) { rspamd_upstream_ok (session->up); if (reply->type == REDIS_REPLY_ARRAY) { @@ -1407,9 +1404,8 @@ rspamd_fuzzy_redis_update_callback (redisAsyncContext *c, gpointer r, msg_err_redis_session ("error sending update to redis %s: %s", rspamd_inet_address_to_string_pretty (rspamd_upstream_addr_cur (session->up)), c->errstr); + rspamd_upstream_fail (session->up, FALSE, c->errstr); } - - rspamd_upstream_fail (session->up, FALSE, strerror (errno)); } rspamd_fuzzy_redis_session_dtor (session, FALSE); |