Handle timeouts in epoll

This commit is contained in:
2023-01-08 21:58:27 +01:00
parent 83ca2467de
commit 4ff22bd0c6
10 changed files with 131 additions and 36 deletions

View File

@ -90,7 +90,7 @@ static int tcp_acceptor(client_ctx_t *ctx) {
ctx->host[0] != 0 ? ctx->host : "", ctx->host[0] != 0 ? ") " : "",
ctx->cc[0] != 0 ? ctx->cc : "N/A");
if (sock_set_timeout(client, CLIENT_TIMEOUT)) {
if (sock_set_socket_timeout(client, 1) != 0 || sock_set_timeout(client, CLIENT_TIMEOUT) != 0) {
error("Unable to set timeout for socket");
return -1;
}
@ -108,6 +108,7 @@ static int tcp_acceptor(client_ctx_t *ctx) {
info("Unable to perform handshake: %s", sock_strerror(client));
return - 1;
}
client->ts_last = clock_micros();
}
ctx->req_num = 0;