luaL_unref (L, LUA_REGISTRYINDEX, cbref);
}
- msg_err ("incorrect function invocation");
+ msg_err_task_check ("incorrect function invocation");
}
}
else if ((task = lua_check_task (L, 1)) != NULL) {
ret = TRUE;
}
else {
- msg_err ("incorrect function invocation");
+ msg_err_task_check ("incorrect function invocation");
}
}
if (ud->ctx == NULL || ud->ctx->err) {
if (ud->ctx) {
+ msg_err_task_check ("cannot connect to redis: %s",
+ ud->ctx->errstr);
redisAsyncFree (ud->ctx);
ud->ctx = NULL;
}
+ else {
+ msg_err_task_check ("cannot connect to redis: unknown error");
+ }
REDIS_RELEASE (ctx);
lua_pushboolean (L, FALSE);
ret = TRUE;
}
else {
- msg_info ("call to redis failed: %s", ud->ctx->errstr);
+ msg_info_task_check ("call to redis failed: %s", ud->ctx->errstr);
redisAsyncFree (ud->ctx);
ud->ctx = NULL;
REDIS_RELEASE (ctx);
lua_pushboolean (L, ret);
if (ret) {
-
pctx = lua_newuserdata (L, sizeof (ctx));
*pctx = ctx;
rspamd_lua_setclass (L, "rspamd{redis}", -1);
rspamd_inet_address_get_port (addr->addr));
if (ud->ctx == NULL || ud->ctx->err) {
+ msg_err_task_check ("cannot connect to redis: %s",
+ ud->ctx->errstr);
REDIS_RELEASE (ctx);
lua_pushboolean (L, FALSE);
guint nargs = 0;
gint cbref = -1, ret;
struct timeval tv;
+ struct rspamd_task *task;
if (ctx) {
if (ctx->async) {
+ task = ctx->d.async.task;
+
/* Async version */
if (lua_type (L, 2) == LUA_TSTRING) {
/* No callback version */
ctx->cmds_pending ++;
}
else {
- msg_info ("call to redis failed: %s", sp_ud->c->ctx->errstr);
+ msg_info_task_check ("call to redis failed: %s",
+ sp_ud->c->ctx->errstr);
lua_pushboolean (L, 0);
lua_pushstring (L, sp_ud->c->ctx->errstr);
return 2;