Added client, fixed typo
This commit is contained in:
17
main.c
17
main.c
@@ -9,8 +9,9 @@
|
||||
#include <sys/epoll.h>
|
||||
#include <sys/signalfd.h>
|
||||
|
||||
#include "event_loop.h"
|
||||
#include "client.h"
|
||||
#include "connection.h"
|
||||
#include "event_loop.h"
|
||||
#include "server.h"
|
||||
#include "utils.h"
|
||||
|
||||
@@ -184,6 +185,10 @@ static void on_fd_event(int fd, uint32_t events) {
|
||||
else if (connection_is_socket_managed(fd)) {
|
||||
connection_event(fd, events);
|
||||
}
|
||||
// Client event
|
||||
else if (client_event(fd, events)) {
|
||||
// nothing here
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "[!] Event has happened on an unknown file descriptor\n");
|
||||
}
|
||||
@@ -209,6 +214,13 @@ int main(int argc, char **argv) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!client_init()) {
|
||||
signals_deinit();
|
||||
loop_deinit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// Loop
|
||||
while (_to_work) {
|
||||
if (!loop_wait()) {
|
||||
@@ -221,6 +233,9 @@ int main(int argc, char **argv) {
|
||||
if (_is_server) {
|
||||
server_close();
|
||||
}
|
||||
else {
|
||||
client_deinit();
|
||||
}
|
||||
connection_cleanup();
|
||||
signals_deinit();
|
||||
loop_deinit();
|
||||
|
||||
Reference in New Issue
Block a user