Update client.rs

pull/313/head
ssrlive 2 years ago committed by GitHub
parent 99f00bb6ef
commit c01a059555
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      src/client.rs

@ -120,14 +120,14 @@ pub fn connect_with_config<Req: IntoClientRequest>(
/// you want to use other TLS libraries, use `client` instead.
///
/// [readme]: https://github.com/snapview/tungstenite-rs/#features
pub fn connect_to_raw_stream<Req: IntoClientRequest>(
pub fn connect_to_raw_stream<Req: IntoClientRequest, Stream: Read + Write + NoDelay>(
request: Req,
stream: TcpStream,
) -> Result<(WebSocket<MaybeTlsStream<TcpStream>>, Response)> {
fn try_client_handshake(
stream: Stream,
) -> Result<(WebSocket<MaybeTlsStream<Stream>>, Response)> {
fn try_client_handshake<Stream: Read + Write + NoDelay>(
request: Request,
mut stream: TcpStream,
) -> Result<(WebSocket<MaybeTlsStream<TcpStream>>, Response)> {
mut stream: Stream,
) -> Result<(WebSocket<MaybeTlsStream<Stream>>, Response)> {
NoDelay::set_nodelay(&mut stream, true)?;
#[cfg(not(any(feature = "native-tls", feature = "__rustls-tls")))]

Loading…
Cancel
Save