ocaml-tls
ocaml-tls copied to clipboard
Implement Eio.Resource.Close
After shutting down the TLS flow, I would like to close the underlying TCP socket. This is of course handled by the switch, but since I'm using resource pooling, I would like to do this before leaving the scope of the switch. I could pass around the TCP flow along with the TLS flow, but this breaks the flow-abstraction which is very useful when dealing with TLS.
My proposal here is the the TLS flow implements the close interface but falls back to no-op if the underlying flow does not implement it. We could consider making close a requirement for the underlying flow, since it should be possible to amend a no-op close operation to an existing flow in the (unlikely?) event that a non-TCP flow is used.
(I made a hack around the issue, but I prefer a more proper solution.)