diff options
author | Thomas Harning Jr <harningt@gmail.com> | 2007-06-13 04:32:12 +0000 |
---|---|---|
committer | Thomas Harning Jr <harningt@gmail.com> | 2007-06-13 04:32:12 +0000 |
commit | dbea9370eb58cdc3cbd1b12d8c8735582370cd6e (patch) | |
tree | 80526dffa240d3eca832114e98490f9632925176 /luaevent/src | |
parent | a309c7952c6ae1b9ad9c9c0c0d895e1ad969cb95 (diff) | |
download | luaevent-prosody-dbea9370eb58cdc3cbd1b12d8c8735582370cd6e.tar.gz luaevent-prosody-dbea9370eb58cdc3cbd1b12d8c8735582370cd6e.zip |
Setup management of socket create/close.
Recognized new bug: cannot create threads within threads... C contains reference to closed thread, not
global.
Diffstat (limited to 'luaevent/src')
-rw-r--r-- | luaevent/src/luaevent.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/luaevent/src/luaevent.c b/luaevent/src/luaevent.c index 8539a99..e5e33cf 100644 --- a/luaevent/src/luaevent.c +++ b/luaevent/src/luaevent.c @@ -31,6 +31,7 @@ static void freeCallbackArgs(le_callback* arg) { arg->L = NULL; event_del(&arg->ev); luaL_unref(L, LUA_REGISTRYINDEX, arg->callbackRef); + luaL_unref(L, LUA_REGISTRYINDEX, arg->objectRef); } } @@ -47,7 +48,6 @@ static int call_callback_function(lua_State* L, int argCount) { if(ret < 0) { /* Done, no need to setup event */ return -1; } - printf("WAITING FOR: %i RED: %i WR:%i\n", ret, EV_READ, EV_WRITE); if(ret != EV_READ && ret != EV_WRITE) { printf("BAD RET_VAL IN INIT: %i\n", ret); } @@ -80,7 +80,6 @@ static void luaevent_callback(int fd, short event, void* p) { return; } - printf("RET VAL: %i\n", ret); if(event != ret) setup_event(arg, fd, ret, 1); } @@ -126,7 +125,8 @@ static void push_new_callback(lua_State* L, int callbackRef, int fd, short event arg->L = L; arg->callbackRef = callbackRef; - + lua_pushvalue(L, -1); + arg->objectRef = luaL_ref(L, LUA_REGISTRYINDEX); setup_event(arg, fd, event, 0); } /* Expected to be called at the beginning of the coro that uses it.. |