Splitting in request_handler and responder

This commit is contained in:
2022-12-29 18:51:12 +01:00
parent f241913620
commit 665e4ceabc
6 changed files with 541 additions and 420 deletions

View File

@ -18,6 +18,7 @@
#include "lib/geoip.h"
#include "worker/tcp_closer.h"
#include "worker/request_handler.h"
#include "worker/responder.h"
#include <stdio.h>
#include <getopt.h>
@ -113,11 +114,12 @@ static void terminate_gracefully(int sig) {
tcp_acceptor_stop();
request_handler_stop();
tcp_closer_stop();
responder_stop();
tcp_acceptor_destroy();
request_handler_destroy();
tcp_closer_destroy();
responder_destroy();
for (int i = 0; i < NUM_SOCKETS; i++) {
close(sockets[i]);
@ -265,6 +267,7 @@ int main(int argc, char *const argv[]) {
tcp_acceptor_init(CNX_HANDLER_WORKERS, 64);
tcp_closer_init(CNX_HANDLER_WORKERS, 64);
request_handler_init(REQ_HANDLER_WORKERS, 64);
responder_init(REQ_HANDLER_WORKERS, 64);
for (int i = 0; i < NUM_SOCKETS; i++) {
async(sockets[i], POLLIN, ASYNC_KEEP, accept_cb, &sockets[i], accept_err_cb, &sockets[i]);