Calling epoll with a timeout prevents the server from waiting endlessly for a connection which may be broken or has faulty requests, such as a chunked body which is missing the zero-size chunk at the end. The server would be stuck in an endless loop otherwise, expecting to find this zero chunk to indicate the end of the body. Having a timeout will help to break out of the loop and take appropriate actions e.g. closing the connection.
EDIT:
Alternatively implement a check in the parseChunkedBody() loop for current body length vs. max. allowed body length (defined by config file or default value). Break out of loop if check condition reached.
Calling epoll with a timeout prevents the server from waiting endlessly for a connection which may be broken or has faulty requests, such as a chunked body which is missing the zero-size chunk at the end. The server would be stuck in an endless loop otherwise, expecting to find this zero chunk to indicate the end of the body. Having a timeout will help to break out of the loop and take appropriate actions e.g. closing the connection.
EDIT: Alternatively implement a check in the parseChunkedBody() loop for current body length vs. max. allowed body length (defined by config file or default value). Break out of loop if check condition reached.