Remove tcp_closer

This commit is contained in:
2022-12-31 11:20:29 +01:00
parent 33feabdec0
commit 9cb278eb2a
7 changed files with 21 additions and 46 deletions

View File

@ -116,3 +116,15 @@ static int tcp_acceptor(client_ctx_t *ctx) {
return 0;
}
void tcp_close(client_ctx_t *ctx) {
logger_set_prefix("[%*s]%s", INET6_ADDRSTRLEN, ctx->socket.s_addr, ctx->log_prefix);
sock_close(&ctx->socket);
ctx->cnx_e = clock_micros();
char buf[32];
info("Connection closed (%s)", format_duration(ctx->cnx_e - ctx->cnx_s, buf));
memset(ctx, 0, sizeof(*ctx));
}