tokio-rs / tls

A collection of Tokio based TLS libraries.

Home Page:https://tokio.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`try_read` for `TlsStream`

BratSinot opened this issue · comments

Greetings!

Any way to implement something like TcpStream::try_read but for TlsStream?
I need to try to read data without waiting for data arriving.

Which tls crate are you talking about?

Which tls crate are you talking about?

tokio-rustls.
But tokio-native-tls have same api (trait AsyncRead + AsyncReadExt) so question will be same for both of them.

If you have a std::task::Context you can call AsyncRead::poll_read() directly, I suppose, and handle Poll::Pending appropriately? You might get a Context through calling poll_fn().

tokio-rustls has moved to https://github.com/rustls/tokio-rustls. Please reopen your issue there if you're still interested.