backend and frontend: support out of order chunks + now it's performant on chrome
This commit is contained in:
@@ -29,6 +29,12 @@ async fn setup_webtransport(
|
||||
) -> Result<(
|
||||
impl tokio::io::AsyncWrite + Send + Sync + 'static,
|
||||
impl tokio::io::AsyncRead + Send + Sync + 'static,
|
||||
h3_datagram::datagram_handler::DatagramSender<
|
||||
<h3_quinn::Connection as h3_datagram::quic_traits::DatagramConnectionExt<
|
||||
salvo::hyper::body::Bytes,
|
||||
>>::SendDatagramHandler,
|
||||
salvo::hyper::body::Bytes,
|
||||
>,
|
||||
//salvo::webtransport::stream::SendStream<
|
||||
// impl salvo::proto::quic::SendStream<salvo::hyper::body::Bytes>,
|
||||
// salvo::hyper::body::Bytes,
|
||||
@@ -39,13 +45,17 @@ async fn setup_webtransport(
|
||||
//>,
|
||||
)> {
|
||||
let session = req.web_transport_mut().await?;
|
||||
|
||||
let datagram_send = session.datagram_sender();
|
||||
|
||||
let bidirectional_stream = session
|
||||
.accept_bi()
|
||||
.await?
|
||||
.ok_or(anyhow!("No bidirectional stream"))?;
|
||||
|
||||
if let webtransport::server::AcceptedBi::BidiStream(_, stream) = bidirectional_stream {
|
||||
Ok(stream.split())
|
||||
let (stream_send, stream_recv) = stream.split();
|
||||
Ok((stream_send, stream_recv, datagram_send))
|
||||
} else {
|
||||
Err(anyhow!("bidirectional stream was of the wrong type"))
|
||||
}
|
||||
@@ -76,7 +86,8 @@ impl crate::proxy::Proxy {
|
||||
});
|
||||
|
||||
info!("WebTransport connection initiated");
|
||||
let (wt_send, wt_recv) = match setup_webtransport(req).await {
|
||||
let (wt_stream_send, wt_stream_recv, wt_datagram_send) = match setup_webtransport(req).await
|
||||
{
|
||||
Ok(w) => w,
|
||||
Err(e) => {
|
||||
error!("Could not upgrade connection to WebTransport: {e}");
|
||||
@@ -95,7 +106,7 @@ impl crate::proxy::Proxy {
|
||||
}
|
||||
};
|
||||
|
||||
match super::proxy_main(stream, wt_send, wt_recv).await {
|
||||
match super::proxy_main(stream, wt_stream_send, wt_stream_recv, wt_datagram_send).await {
|
||||
Ok(()) => Ok(()),
|
||||
Err(e) => {
|
||||
error!("Proxy main loop failed: {e}");
|
||||
|
||||
Reference in New Issue
Block a user