Commit 2faa146b authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

httpd: update activity time on actual activity

Account for actual data read or written, rather than iteration of the
poll loop.

Note: This won't count TLS handshake progress as activity. But if
the client cannot complete the handshake within a time-out interval,
we might as well drop it.
parent e484fdda
......@@ -1986,6 +1986,7 @@ static void httpdLoop(httpd_host_t *host)
vlc_list_foreach(cl, &host->clients, node) {
const struct pollfd *pufd = &ufd[nfd];
int val = -1;
assert(pufd < &ufd[ARRAY_SIZE(ufd)]);
......@@ -1995,16 +1996,21 @@ static void httpdLoop(httpd_host_t *host)
if (pufd->revents == 0)
continue; // no event received
cl->i_activity_date = now;
switch (cl->i_state) {
case HTTPD_CLIENT_RECEIVING: httpd_ClientRecv(cl); break;
case HTTPD_CLIENT_SENDING: httpd_ClientSend(cl); break;
case HTTPD_CLIENT_RECEIVING:
val = httpd_ClientRecv(cl);
break;
case HTTPD_CLIENT_SENDING:
val = httpd_ClientSend(cl);
break;
case HTTPD_CLIENT_TLS_HS_IN:
case HTTPD_CLIENT_TLS_HS_OUT:
httpd_ClientTlsHandshake(host, cl);
break;
}
if (val == 0)
cl->i_activity_date = now;
}
/* Handle server sockets (accept new connections) */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment