summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--main.c3
-rw-r--r--plop.c5
-rw-r--r--plop.h6
3 files changed, 7 insertions, 7 deletions
diff --git a/main.c b/main.c
index 94b8bde..2e0320c 100644
--- a/main.c
+++ b/main.c
@@ -107,7 +107,8 @@ int main(int argc, char ** argv)
}
else
{
- if (-1 == plop_handle_client(plop.L, &events[i]))
+ struct connection * c = (struct connection *) events[i].data.ptr;
+ if (-1 == plop_handle_client(plop.L, c))
{
return 7;
}
diff --git a/plop.c b/plop.c
index 8a21919..f9d4de2 100644
--- a/plop.c
+++ b/plop.c
@@ -140,11 +140,10 @@ int plop_load_handler(lua_State * L, const char * path)
/// Handles client events.
/// \param L Server's Lua state
-/// \param event Event for client
+/// \param c Connection associated with the client
/// \return -1 if an error occured
-int plop_handle_client(lua_State * L, struct epoll_event * event)
+int plop_handle_client(lua_State * L, struct connection * c)
{
- struct connection * c = (struct connection *) event->data.ptr;
int nargs = 0;
if (NULL == c->L)
diff --git a/plop.h b/plop.h
index 903fb1f..ede7888 100644
--- a/plop.h
+++ b/plop.h
@@ -1,9 +1,9 @@
#pragma once
-#include <sys/epoll.h>
-
#include <lua.h>
+#include "connection.h"
+
struct plop
{
const char * handler;
@@ -16,5 +16,5 @@ extern struct plop plop;
lua_State * plop_initialize_lua(void);
int open_server(const char *, const char *);
int plop_load_handler(lua_State *, const char *);
-int plop_handle_client(lua_State *, struct epoll_event *);
+int plop_handle_client(lua_State *, struct connection *);
int plop_handle_server(lua_State *, const int, const int);