g_slice_free1 (sizeof (*pool), pool);
}
+
+const gchar*
+rspamd_redis_type_to_string (int type)
+{
+ const gchar *ret = "unknown";
+
+ switch (type) {
+ case REDIS_REPLY_STRING:
+ ret = "string";
+ break;
+ case REDIS_REPLY_ARRAY:
+ ret = "array";
+ break;
+ case REDIS_REPLY_INTEGER:
+ ret = "int";
+ break;
+ case REDIS_REPLY_STATUS:
+ ret = "status";
+ break;
+ case REDIS_REPLY_NIL:
+ ret = "nil";
+ break;
+ case REDIS_REPLY_ERROR:
+ ret = "error";
+ break;
+ default:
+ break;
+ }
+
+ return ret;
+}
*/
void rspamd_redis_pool_destroy (struct rspamd_redis_pool *pool);
+/**
+ * Missing in hiredis
+ * @param type
+ * @return
+ */
+const gchar* rspamd_redis_type_to_string (int type);
+
#endif /* SRC_LIBSERVER_REDIS_POOL_H_ */
}
else {
if (reply->type != REDIS_REPLY_NIL) {
- msg_err_task ("bad learned type for %s: %d",
- rt->stcf->symbol, reply->type);
+ msg_err_task ("bad learned type for %s: %s, nil expected",
+ rt->stcf->symbol,
+ rspamd_redis_type_to_string (reply->type));
}
val = 0;
}
}
else {
- msg_err_task_check ("got invalid reply from redis: %d",
- reply->type);
+ msg_err_task_check ("got invalid reply from redis: %s, array expected",
+ rspamd_redis_type_to_string (reply->type));
}
msg_debug_task_check ("received tokens for %s: %d processed, %d found",