aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/tcp_server.c
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-06-13 01:50:24 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-06-13 01:50:24 +0200
commit5b58c9fd2880911aa926259d97a396e97f3d4313 (patch)
treefefbc7a72447f2f12adbe0e16d6f597cf05e3fdf /src/tcp_server.c
parentuse signalfd to stop on SIGTERM (diff)
downloadcimple-5b58c9fd2880911aa926259d97a396e97f3d4313.tar.gz
cimple-5b58c9fd2880911aa926259d97a396e97f3d4313.zip
event_loop: hide the API details
Diffstat (limited to 'src/tcp_server.c')
-rw-r--r--src/tcp_server.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/tcp_server.c b/src/tcp_server.c
index a6263f7..ba310a8 100644
--- a/src/tcp_server.c
+++ b/src/tcp_server.c
@@ -143,8 +143,8 @@ close_conn:
return ret;
}
-static int tcp_server_event_loop_handler(UNUSED struct event_loop *loop, UNUSED int fd,
- UNUSED short revents, void *_server)
+static int tcp_server_event_handler(UNUSED struct event_loop *loop, UNUSED int fd,
+ UNUSED short revents, void *_server)
{
struct tcp_server *server = (struct tcp_server *)_server;
return tcp_server_accept(server);
@@ -152,11 +152,5 @@ static int tcp_server_event_loop_handler(UNUSED struct event_loop *loop, UNUSED
int tcp_server_add_to_event_loop(struct tcp_server *server, struct event_loop *loop)
{
- struct event_fd entry = {
- .fd = server->fd,
- .events = POLLIN,
- .handler = tcp_server_event_loop_handler,
- .arg = server,
- };
- return event_loop_add(loop, &entry);
+ return event_loop_add(loop, server->fd, POLLIN, tcp_server_event_handler, server);
}