#580 remove old keepalive code

Needed by the old socket Hydra that does not exist anymore
master
OpenGnSys Support Team 2021-05-04 16:11:34 +02:00
parent 927d42bdf8
commit 8a0a32cea1
2 changed files with 2 additions and 24 deletions

View File

@ -33,12 +33,6 @@ static void og_client_release(struct ev_loop *loop, struct og_client *cli)
free(cli); free(cli);
} }
static void og_client_reset_state(struct og_client *cli)
{
cli->state = OG_CLIENT_RECEIVING_HEADER;
cli->buf_len = 0;
}
static int og_client_payload_too_large(struct og_client *cli) static int og_client_payload_too_large(struct og_client *cli)
{ {
char buf[] = "HTTP/1.1 413 Payload Too Large\r\n" char buf[] = "HTTP/1.1 413 Payload Too Large\r\n"
@ -111,9 +105,6 @@ static void og_client_read_cb(struct ev_loop *loop, struct ev_io *io, int events
if (ret <= 0) if (ret <= 0)
goto close; goto close;
if (cli->keepalive_idx >= 0)
return;
ev_timer_again(loop, &cli->timer); ev_timer_again(loop, &cli->timer);
cli->buf_len += ret; cli->buf_len += ret;
@ -148,15 +139,7 @@ static void og_client_read_cb(struct ev_loop *loop, struct ev_io *io, int events
inet_ntoa(cli->addr.sin_addr), inet_ntoa(cli->addr.sin_addr),
ntohs(cli->addr.sin_port)); ntohs(cli->addr.sin_port));
} }
if (ret < 0)
goto close; goto close;
if (cli->keepalive_idx < 0) {
goto close;
} else {
og_client_reset_state(cli);
}
break;
default: default:
syslog(LOG_ERR, "unknown state, critical internal error\n"); syslog(LOG_ERR, "unknown state, critical internal error\n");
goto close; goto close;
@ -281,7 +264,7 @@ static void og_client_timer_cb(struct ev_loop *loop, ev_timer *timer, int events
struct og_client *cli; struct og_client *cli;
cli = container_of(timer, struct og_client, timer); cli = container_of(timer, struct og_client, timer);
if (cli->keepalive_idx >= 0) { if (cli->agent) {
ev_timer_again(loop, &cli->timer); ev_timer_again(loop, &cli->timer);
return; return;
} }
@ -355,10 +338,6 @@ void og_server_accept_cb(struct ev_loop *loop, struct ev_io *io, int events)
return; return;
} }
memcpy(&cli->addr, &client_addr, sizeof(client_addr)); memcpy(&cli->addr, &client_addr, sizeof(client_addr));
if (io->fd == socket_agent_rest)
cli->keepalive_idx = 0;
else
cli->keepalive_idx = -1;
if (io->fd == socket_rest) if (io->fd == socket_rest)
cli->rest = true; cli->rest = true;

View File

@ -48,7 +48,6 @@ struct og_client {
char buf[OG_MSG_REQUEST_MAXLEN]; char buf[OG_MSG_REQUEST_MAXLEN];
unsigned int buf_len; unsigned int buf_len;
unsigned int msg_len; unsigned int msg_len;
int keepalive_idx;
bool rest; bool rest;
bool agent; bool agent;
int content_length; int content_length;