aboutsummaryrefslogtreecommitdiff
path: root/server.c
diff options
context:
space:
mode:
authorGuangxiong Lin <[email protected]>2022-12-16 13:53:35 +0800
committerGuangxiong Lin <[email protected]>2022-12-16 13:53:35 +0800
commit7369505397cdfddf0883e2c24e1652df8bd488fe (patch)
treee961bd1bba0276e2c5f523bf12663b34983c9e51 /server.c
parent49839c88a98d3798f7b18c58f54f26f36cacff38 (diff)
downloadtinyserver-7369505397cdfddf0883e2c24e1652df8bd488fe.tar.gz
tinyserver-7369505397cdfddf0883e2c24e1652df8bd488fe.tar.bz2
tinyserver-7369505397cdfddf0883e2c24e1652df8bd488fe.zip
Refactor file structure
Diffstat (limited to 'server.c')
-rw-r--r--server.c40
1 files changed, 0 insertions, 40 deletions
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 <netinet/in.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <strings.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <sys/epoll.h>
-#include <errno.h>
-
-#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);
-}