HTTP3 cannot start in the tokio::spawn
Closed this issue · 1 comments
focus1024-wind commented
When I want to use HTTP3 with tokio::join!,Default start in the tokio::spawn(async move) can use but HTTP3 is bad.
let router = Router::new().post(hello);
let service = Service::new(router)
.hoop(Logger::new())
.catcher(middleware::catcher());
let config = RustlsConfig::new(Keycert::new().cert(cert.as_slice()).key(key.as_slice()));
let listener = TcpListener::new("127.0.0.1:8848").rustls(config.clone());
let acceptor = QuinnListener::new(config, "127.0.0.1:8848")
.join(listener)
.bind()
.await;
tokio::spawn(async move {
Server::new(acceptor).serve(service).await;
})
the error is :
| / tokio::spawn(async move {
39 | | Server::new(acceptor).serve(service).await;
40 | | })
| |______^ implementation of `Send` is not general enough
|
= note: `Send` would have to be implemented for the type `&tokio_rustls::TlsAcceptor`
= note: ...but `Send` is actually implemented for the type `&'0 tokio_rustls::TlsAcceptor`, for some specific lifetime `'0`
38 | / tokio::spawn(async move {
39 | | Server::new(acceptor).serve(service).await;
40 | | })
| |______^ implementation of `Send` is not general enough
|
= note: `Send` would have to be implemented for the type `&runtime::io::registration::Registration`
= note: ...but `Send` is actually implemented for the type `&'0 runtime::io::registration::Registration`, for some specific lifetime `'0`
the dependencies version is:
# -- Async
tokio = { version = "1.40.0", features = ["macros"] }
# -- Web
salvo = { version = "0.71.1", features = ["quinn", "logging"] }
# -- Tracing
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
chrislearn commented
It looks like this is the same issue: