summaryrefslogtreecommitdiffstats
path: root/src/lua/lua_task.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2012-07-24 20:37:51 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2012-07-24 20:37:51 +0400
commit0d35a8f9cb4942e84d3e26ca4d010393a56e2904 (patch)
tree78e7c59b17764b471e8694ee134327d4b33868a5 /src/lua/lua_task.c
parent7ef494782ccfa6dfdd8bc2187cba43628535277b (diff)
downloadrspamd-0d35a8f9cb4942e84d3e26ca4d010393a56e2904.tar.gz
rspamd-0d35a8f9cb4942e84d3e26ca4d010393a56e2904.zip
* Add lua_buffer bindings to async buffered rspamd API.
Diffstat (limited to 'src/lua/lua_task.c')
-rw-r--r--src/lua/lua_task.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 3ef88e390..3aa204597 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -45,6 +45,7 @@ extern stat_file_t* get_statfile_by_symbol (statfile_pool_t *pool, struct classi
/* Task methods */
LUA_FUNCTION_DEF (task, get_message);
LUA_FUNCTION_DEF (task, get_mempool);
+LUA_FUNCTION_DEF (task, get_ev_base);
LUA_FUNCTION_DEF (task, insert_result);
LUA_FUNCTION_DEF (task, set_pre_result);
LUA_FUNCTION_DEF (task, get_urls);
@@ -79,6 +80,7 @@ LUA_FUNCTION_DEF (task, learn_statfile);
static const struct luaL_reg tasklib_m[] = {
LUA_INTERFACE_DEF (task, get_message),
LUA_INTERFACE_DEF (task, get_mempool),
+ LUA_INTERFACE_DEF (task, get_ev_base),
LUA_INTERFACE_DEF (task, insert_result),
LUA_INTERFACE_DEF (task, set_pre_result),
LUA_INTERFACE_DEF (task, get_urls),
@@ -230,6 +232,20 @@ lua_task_get_mempool (lua_State * L)
return 1;
}
+static int
+lua_task_get_ev_base (lua_State * L)
+{
+ struct event_base **pbase;
+ struct worker_task *task = lua_check_task (L);
+
+ if (task != NULL) {
+ pbase = lua_newuserdata (L, sizeof (struct event_base *));
+ lua_setclass (L, "rspamd{ev_base}", -1);
+ *pbase = task->ev_base;
+ }
+ return 1;
+}
+
static gint
lua_task_insert_result (lua_State * L)
{