Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Itsusinn committed Dec 23, 2024
1 parent 90f3a7f commit c48a4d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clash_lib/src/proxy/transport/ws/websocket.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{fmt::Debug, pin::Pin, task::Poll};

use bytes::BytesMut;
use bytes::{Bytes, BytesMut};
use futures::{ready, Sink, Stream};
use tokio::io::{AsyncRead, AsyncWrite};
use tokio_tungstenite::{tungstenite::Message, WebSocketStream};
Expand Down Expand Up @@ -81,7 +81,7 @@ impl AsyncWrite for WebsocketConn {
buf: &[u8],
) -> std::task::Poll<Result<usize, std::io::Error>> {
ready!(Pin::new(&mut self.inner).poll_ready(cx)).map_err(map_io_error)?;
let message = Message::Binary(buf.into());
let message = Message::Binary(Bytes::copy_from_slice(buf));
Pin::new(&mut self.inner)
.start_send(message)
.map_err(map_io_error)?;
Expand Down

0 comments on commit c48a4d7

Please sign in to comment.