diff options
Diffstat (limited to 'plop.c')
-rw-r--r-- | plop.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -17,6 +17,7 @@ #include "connection.h" #include "stream.h" +#include "response.h" /// Initializes new Lua state for the server. /// \return Lua state @@ -158,20 +159,31 @@ int plop_handle_client(lua_State * L, struct epoll_event * event) } int result = lua_resume(c->L, NULL, nargs); - connection_free(L, c); // TODO: Allow consistent connections? switch (result) { case LUA_OK: { + int n = lua_gettop(c->L); + + if (0 == n) + { + lua_pushnil(c->L); + } + + response_send(c->L, c->fd); + connection_free(L, c); + return 0; } case LUA_YIELD: { + connection_free(L, c); // TODO: This shouldn't be the case... Right? return 0; } default: { + connection_free(L, c); return -1; } } |