Remove tcp_closer
This commit is contained in:
@ -12,12 +12,11 @@
|
||||
#include "worker/func.h"
|
||||
#include "async.h"
|
||||
|
||||
static mpmc_t tcp_acceptor_ctx, tcp_closer_ctx, request_handler_ctx,
|
||||
static mpmc_t tcp_acceptor_ctx, request_handler_ctx,
|
||||
local_handler_ctx, fastcgi_handler_cxt, proxy_handler_ctx;
|
||||
|
||||
int workers_init(void) {
|
||||
mpmc_init(&tcp_acceptor_ctx, 8, 64, (void (*)(void *)) tcp_acceptor_func, "tcp_a");
|
||||
mpmc_init(&tcp_closer_ctx, 8, 64, (void (*)(void *)) tcp_closer_func, "tcp_c");
|
||||
mpmc_init(&tcp_acceptor_ctx, 8, 64, (void (*)(void *)) tcp_acceptor_func, "tcp");
|
||||
mpmc_init(&request_handler_ctx, 16, 64, (void (*)(void *)) request_handler_func, "req");
|
||||
mpmc_init(&local_handler_ctx, 16, 64, (void (*)(void *)) local_handler_func, "local");
|
||||
mpmc_init(&fastcgi_handler_cxt, 16, 64, (void (*)(void *)) fastcgi_handler_func, "fcgi");
|
||||
@ -31,7 +30,6 @@ void workers_stop(void) {
|
||||
mpmc_stop(&fastcgi_handler_cxt);
|
||||
mpmc_stop(&proxy_handler_ctx);
|
||||
mpmc_stop(&request_handler_ctx);
|
||||
mpmc_stop(&tcp_closer_ctx);
|
||||
}
|
||||
|
||||
void workers_destroy(void) {
|
||||
@ -40,17 +38,12 @@ void workers_destroy(void) {
|
||||
mpmc_destroy(&fastcgi_handler_cxt);
|
||||
mpmc_destroy(&proxy_handler_ctx);
|
||||
mpmc_destroy(&request_handler_ctx);
|
||||
mpmc_destroy(&tcp_closer_ctx);
|
||||
}
|
||||
|
||||
int tcp_accept(client_ctx_t *ctx) {
|
||||
return mpmc_queue(&tcp_acceptor_ctx, ctx);
|
||||
}
|
||||
|
||||
int tcp_close(client_ctx_t *ctx) {
|
||||
return mpmc_queue(&tcp_closer_ctx, ctx);
|
||||
}
|
||||
|
||||
static int handle_request_cb(client_ctx_t *ctx) {
|
||||
return mpmc_queue(&request_handler_ctx, ctx);
|
||||
}
|
||||
@ -59,7 +52,8 @@ int handle_request(client_ctx_t *ctx) {
|
||||
if (ctx->c_keep_alive && ctx->s_keep_alive) {
|
||||
return async(ctx->socket.socket, POLLIN, 0, (void (*)(void *)) handle_request_cb, ctx, (void (*)(void *)) tcp_close, ctx);
|
||||
} else {
|
||||
return tcp_close(ctx);
|
||||
tcp_close(ctx);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user