dnsdist: Implement read-ahead support for incoming TLS connections
Read-ahead instructs OpenSSL to read more than the number of bytes
we requested from the incoming connection, if possible, and to buffer
it. This provides a huge performance boost by reducing the number
of syscalls because in most cases the data is already available on
the socket to be read even if we cannot know that yet without reading
the data length.
There are two drawbacks:
- we can keep reading on a connection in a loop as long as there is
data available, which should be prevented by our number of concurrent
requests limit ;
- we need to always try to read all the data available before asking
the kernel to wake us up when the socket is readable, because the
data buffered by OpenSSL is obviously not visible to the kernel so
we could wait forever.