Closed valpackett closed 7 months ago
Good catch! However, I think it's a cyper bug, and should be fixed in 0.1.0-beta.2: https://github.com/compio-rs/cyper/commit/63dbdfeaf84068a39216482200463306959d8844
This PR is not right. shutdown
method should call flush
because the inner buffer should be flushed before the socket shutdown. However, if the flush
method is still pending, shutdown
should be called. That's the bug of HyperStream
in the cyper repo, I think.
is there any reason in particular compio-tls isn't currently using futures-rustls and async-native-tls?
Yes. The sockets in compio is dealt very much differently to other crates, especially on Windows (IOCP) and Linux (io-uring).
Oh, I understand. It is caused by a poll_flush
call after poll_shutdown
. I'll close this PR and open an issue in cyper repo.
Leaving this around in case the debug instrumentation is useful to anyone (:
The sockets in compio is dealt very much differently to other crates, especially on Windows (IOCP) and Linux (io-uring).
hmm, but glommio does implement futures::io traits so futures-rustls does just work…
but glommio does implement futures::io traits so futures-rustls does just work…
It uses a buffer inside the stream.
When trying to get a basic HTTPS server to work:
the code
```rust mod rustls_config; use std::{convert::Infallible, path::Path, sync::Arc}; use compio::{net::TcpListener, tls::TlsAcceptor, driver::{IntoRawFd, FromRawFd}}; use http_body_util::Full; use hyper::{ body::{Bytes, Incoming}, Request, Response, }; async fn hello(_: Requesta MISSING_BUF panic would happen. I've added a debugging feature to print the backtrace of the first
Buffer::take_inner
if a second one occurs before the buffer is returned, and got this:With that I found that removing the shutdown → flush call got rid of the issue. Still that feels odd that it happens!
By the way, that TLS integration via sync stream traits looks a bit odd to me :eyes: I guess that's… fine? in a single-thread runtime…? but is there any reason in particular compio-tls isn't currently using futures-rustls and async-native-tls? (note: by "async-std" support async-native-tls really means futures-util)