mirror of
https://github.com/rustdesk/hbb_common.git
synced 2025-07-02 16:07:10 +00:00
[bug fix] add enc logic.
This commit is contained in:
parent
608eb5983f
commit
880365cab0
@ -95,7 +95,9 @@ impl WsFramedStream {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_raw(&mut self) {}
|
pub fn set_raw(&mut self) {
|
||||||
|
self.encrypt = None;
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn from_tcp_stream(stream: TcpStream, addr: SocketAddr) -> ResultType<Self> {
|
pub async fn from_tcp_stream(stream: TcpStream, addr: SocketAddr) -> ResultType<Self> {
|
||||||
let ws_stream =
|
let ws_stream =
|
||||||
@ -133,6 +135,10 @@ impl WsFramedStream {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub async fn send_raw(&mut self, msg: Vec<u8>) -> ResultType<()> {
|
pub async fn send_raw(&mut self, msg: Vec<u8>) -> ResultType<()> {
|
||||||
|
let mut msg = msg;
|
||||||
|
if let Some(key) = self.encrypt.as_mut() {
|
||||||
|
msg = key.enc(&msg);
|
||||||
|
}
|
||||||
self.send_bytes(Bytes::from(msg)).await
|
self.send_bytes(Bytes::from(msg)).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user