summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2021-08-15 19:21:49 +0200
committerAki <please@ignore.pl>2021-08-15 19:21:49 +0200
commit906eb598f150931e821446e9dcf022ea9052ab36 (patch)
tree5e0d5c24c817ef12437c3705b5844d205c78bce4
parent742b94fbd5756551ab5cd6f2ac1799dfbc7f5152 (diff)
downloadplop-906eb598f150931e821446e9dcf022ea9052ab36.zip
plop-906eb598f150931e821446e9dcf022ea9052ab36.tar.gz
plop-906eb598f150931e821446e9dcf022ea9052ab36.tar.bz2
Removed epoll file descriptor from server handler
-rw-r--r--main.c2
-rw-r--r--plop.c5
-rw-r--r--plop.h2
3 files changed, 4 insertions, 5 deletions
diff --git a/main.c b/main.c
index 7f87ee4..ee7c796 100644
--- a/main.c
+++ b/main.c
@@ -100,7 +100,7 @@ int main(int argc, char ** argv)
{
if (NULL == events[i].data.ptr)
{
- if (-1 == plop_handle_server(plop.efd, server))
+ if (-1 == plop_handle_server(server))
{
return 6;
}
diff --git a/plop.c b/plop.c
index 057208a..3a438e6 100644
--- a/plop.c
+++ b/plop.c
@@ -195,10 +195,9 @@ int plop_handle_client(struct connection * c)
}
/// Accepts awaiting connections if any.
-/// \param efd File descriptor for epoll's context
/// \param server File descriptor for server socket
/// \return -1 if an error occured
-int plop_handle_server(const int efd, const int server)
+int plop_handle_server(const int server)
{
struct epoll_event e;
e.events = EPOLLIN | EPOLLOUT; // TODO: Add EPOLLHUP?
@@ -255,7 +254,7 @@ int plop_handle_server(const int efd, const int server)
connection->push = 1;
e.data.ptr = connection;
- if (-1 == epoll_ctl(efd, EPOLL_CTL_ADD, client, &e))
+ if (-1 == epoll_ctl(plop.efd, EPOLL_CTL_ADD, client, &e))
{
return -1;
}
diff --git a/plop.h b/plop.h
index b1ed235..0cfe428 100644
--- a/plop.h
+++ b/plop.h
@@ -18,4 +18,4 @@ int open_server(const char *, const char *);
int plop_load_handler(lua_State *, const char *);
void plop_drop_thread(const int);
int plop_handle_client(struct connection *);
-int plop_handle_server(const int, const int);
+int plop_handle_server(const int);