Description
Currently, poll_accept gets called on the main tcp accept task but in certain cases we want to run another future on each accept where we perform a TLS handshake. Ideally, we'd like to perform this per-connection workload on the connection task.
Currently, the closet solution to this is to poll the tls handshake future from within the AsyncRead/AsyncWrite implementation on the IO type. This works well if you just want your connection to have TLS but does not work with the MakeService pattern where you might want to fetch peer certificates. This is because we only poll the io type after the MakeService is called.
The main goal here is to let users fetch the io type in the MakeService and extract any post handshake information like peer certs.
Related issue hyperium/tonic#325
Relevant code:
https://github.com/hyperium/hyper/blob/master/src/server/conn.rs#L726
cc @seanmonstar I am not sure exactly what the best solution is here but it would most likely be breaking.