From 7369505397cdfddf0883e2c24e1652df8bd488fe Mon Sep 17 00:00:00 2001 From: Guangxiong Lin Date: Fri, 16 Dec 2022 13:53:35 +0800 Subject: Refactor file structure --- server.c | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 server.c (limited to 'server.c') diff --git a/server.c b/server.c deleted file mode 100644 index 8525689..0000000 --- a/server.c +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "evloop.h" -#include "tsocket.h" -#include "util.h" -#include "acceptor.h" -#include "tpool.h" - -int main() -{ - evloop_t *el = evloop_create(); - if (el == NULL) - panic("eventloop creation"); - - struct tsocket *sock = tsocket_create(); - if (sock == NULL - || tsocket_bind(sock, "127.0.0.1", 8888) == -1 - || tsocket_listen(sock) == -1) - panic("socket creation"); - - tpool = tpool_create(0); - if (!tpool) - panic("tpool_create"); - - event_t *acceptEvent = conn_acceptor_create_event(sock, el); - if (evloop_add(el, acceptEvent, EPOLLIN) == -1) - panic("eventloop add fd"); - - evloop_loop(el); -} -- cgit v1.2.3