modify argument of ConnectionTmpl::send_raw()

This commit is contained in:
tom 2022-07-21 17:54:07 +08:00
parent 9ab955bb8e
commit e811d5f18b
3 changed files with 4 additions and 4 deletions

View File

@ -456,8 +456,8 @@ where
} }
} }
pub async fn send_raw(&mut self, data: Vec<u8>) -> ResultType<()> { pub async fn send_raw(&mut self, data: Bytes) -> ResultType<()> {
self.inner.send(bytes::Bytes::from(data)).await?; self.inner.send(data).await?;
Ok(()) Ok(())
} }

View File

@ -1364,7 +1364,7 @@ async fn start_ipc(
data, data,
compressed}) = data { compressed}) = data {
stream.send(&Data::FS(ipc::FS::WriteBlock{id, file_num, data: Bytes::new(), compressed})).await?; stream.send(&Data::FS(ipc::FS::WriteBlock{id, file_num, data: Bytes::new(), compressed})).await?;
stream.send_raw(data.into()).await?; stream.send_raw(data).await?;
} else { } else {
stream.send(&data).await?; stream.send(&data).await?;
} }

View File

@ -590,7 +590,7 @@ async fn start_pa() {
} else { } else {
buf.clone() buf.clone()
}; };
if let Err(err) = stream.send_raw(out).await { if let Err(err) = stream.send_raw(out.into()).await {
log::error!("Failed to send audio data:{}", err); log::error!("Failed to send audio data:{}", err);
break; break;
} }