mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-12 22:10:01 -04:00
fix muxstreamasyncread
This commit is contained in:
parent
5571a63f40
commit
31b9f1c455
8 changed files with 187 additions and 49 deletions
|
@ -17,7 +17,7 @@ use hyper_util::rt::TokioIo;
|
|||
#[cfg(unix)]
|
||||
use tokio::net::{UnixListener, UnixStream};
|
||||
use tokio::{
|
||||
io::{copy, copy_bidirectional, AsyncBufReadExt, AsyncWriteExt},
|
||||
io::{copy, AsyncBufReadExt, AsyncWriteExt},
|
||||
net::{lookup_host, TcpListener, TcpStream, UdpSocket},
|
||||
select,
|
||||
};
|
||||
|
@ -34,7 +34,7 @@ use wisp_mux::{
|
|||
udp::UdpProtocolExtensionBuilder,
|
||||
ProtocolExtensionBuilder,
|
||||
},
|
||||
CloseReason, ConnectPacket, MuxStream, IoStream, ServerMux, StreamType, WispError,
|
||||
CloseReason, ConnectPacket, MuxStream, MuxStreamAsyncRW, ServerMux, StreamType, WispError,
|
||||
};
|
||||
|
||||
type HttpBody = http_body_util::Full<hyper::body::Bytes>;
|
||||
|
@ -269,8 +269,6 @@ async fn accept_http(
|
|||
}
|
||||
}
|
||||
|
||||
// re-enable once MuxStreamAsyncRW is fixed
|
||||
/*
|
||||
async fn copy_buf(mux: MuxStreamAsyncRW, tcp: TcpStream) -> std::io::Result<()> {
|
||||
let (muxrx, muxtx) = mux.into_split();
|
||||
let mut muxrx = muxrx.compat();
|
||||
|
@ -302,7 +300,6 @@ async fn copy_buf(mux: MuxStreamAsyncRW, tcp: TcpStream) -> std::io::Result<()>
|
|||
x = slow_fut => x.map(|_| ()),
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
async fn handle_mux(
|
||||
packet: ConnectPacket,
|
||||
|
@ -314,9 +311,9 @@ async fn handle_mux(
|
|||
);
|
||||
match packet.stream_type {
|
||||
StreamType::Tcp => {
|
||||
let mut tcp_stream = TcpStream::connect(uri).await?;
|
||||
let mut mux = stream.into_io().into_asyncrw().compat();
|
||||
copy_bidirectional(&mut mux, &mut tcp_stream).await?;
|
||||
let tcp_stream = TcpStream::connect(uri).await?;
|
||||
let mux = stream.into_io().into_asyncrw();
|
||||
copy_buf(mux, tcp_stream).await?;
|
||||
}
|
||||
StreamType::Udp => {
|
||||
let uri = lookup_host(uri)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue