tokio-rs / tls

A collection of Tokio based TLS libraries.
https://tokio.rs
MIT License
253 stars 86 forks source link

`try_read` for `TlsStream` #123

Closed BratSinot closed 1 year ago

BratSinot commented 1 year ago

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.

LucioFranco commented 1 year ago

Which tls crate are you talking about?

BratSinot commented 1 year ago

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.

djc commented 1 year ago

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().

djc commented 1 year ago

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