#include #include #include #include #include #include #include #include #include #include #include #include "eventloop.h" #include "tsocket.h" #include "util.h" #include "connection.h" #include "acceptor.h" int main() { struct eventLoop *el = eventLoopNew(); if (el == NULL) panic("eventloop creation"); struct tsocket *sock = tsocketNew(); if (sock == NULL || tsocketBind(sock, "127.0.0.1", 8888) == -1 || tsocketListen(sock) == -1) panic("socket creation"); struct event *acceptEvent = connAcceptorNewEvent(sock, el); if (eventLoopAdd(el, acceptEvent, EPOLLIN) == -1) panic("eventloop add fd"); eventLoopLoop(el); }