Using new Stream type adapted to the update of submodules (#11581)

* [fix bug] fix all err stream type.

* [update] update hbb_common.

* [bug fix] Stream in other platform.
This commit is contained in:
YinMo19 2025-04-28 00:47:33 +08:00 committed by GitHub
parent 16e9e716b6
commit c9d5e15ac0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 11 additions and 13 deletions

1
Cargo.lock generated
View file

@ -3108,6 +3108,7 @@ dependencies = [
"tokio-tungstenite", "tokio-tungstenite",
"tokio-util", "tokio-util",
"toml 0.7.8", "toml 0.7.8",
"tungstenite",
"url", "url",
"uuid", "uuid",
"winapi 0.3.9", "winapi 0.3.9",

@ -1 +1 @@
Subproject commit ebb4d4a48cf7ed6ca62e93f8ed124065c6408536 Subproject commit 3afaf6494475ef58dcaaae6b4e6d2303cc3d632b

View file

@ -58,7 +58,6 @@ use hbb_common::{
sha2::{Digest, Sha256}, sha2::{Digest, Sha256},
socket_client::{connect_tcp, connect_tcp_local, ipv4_to_ipv6}, socket_client::{connect_tcp, connect_tcp_local, ipv4_to_ipv6},
sodiumoxide::{base64, crypto::sign}, sodiumoxide::{base64, crypto::sign},
tcp::FramedStream,
timeout, timeout,
tokio::{ tokio::{
self, self,
@ -3557,8 +3556,7 @@ pub mod peer_online {
rendezvous_proto::*, rendezvous_proto::*,
sleep, sleep,
socket_client::connect_tcp, socket_client::connect_tcp,
tcp::FramedStream, ResultType, Stream,
ResultType,
}; };
pub async fn query_online_states<F: FnOnce(Vec<String>, Vec<String>)>(ids: Vec<String>, f: F) { pub async fn query_online_states<F: FnOnce(Vec<String>, Vec<String>)>(ids: Vec<String>, f: F) {
@ -3581,7 +3579,7 @@ pub mod peer_online {
} }
} }
async fn create_online_stream() -> ResultType<FramedStream> { async fn create_online_stream() -> ResultType<Stream> {
let (rendezvous_server, _servers, _contained) = let (rendezvous_server, _servers, _contained) =
crate::get_rendezvous_server(READ_TIMEOUT).await; crate::get_rendezvous_server(READ_TIMEOUT).await;
let tmp: Vec<&str> = rendezvous_server.split(":").collect(); let tmp: Vec<&str> = rendezvous_server.split(":").collect();

View file

@ -351,7 +351,7 @@ impl<T: InvokeUiSession> Remote<T> {
#[cfg(any(target_os = "windows", feature = "unix-file-copy-paste"))] #[cfg(any(target_os = "windows", feature = "unix-file-copy-paste"))]
async fn handle_local_clipboard_msg( async fn handle_local_clipboard_msg(
&self, &self,
peer: &mut crate::client::FramedStream, peer: &mut Stream,
msg: Option<clipboard::ClipboardFile>, msg: Option<clipboard::ClipboardFile>,
) { ) {
match msg { match msg {

View file

@ -27,7 +27,7 @@ use hbb_common::{
self, self,
time::{Duration, Instant, Interval}, time::{Duration, Instant, Interval},
}, },
ResultType, ResultType, Stream,
}; };
use crate::{ use crate::{
@ -832,7 +832,7 @@ pub fn is_modifier(evt: &KeyEvent) -> bool {
pub fn check_software_update() { pub fn check_software_update() {
if is_custom_client() { if is_custom_client() {
return; return;
} }
let opt = config::LocalConfig::get_option(config::keys::OPTION_ENABLE_CHECK_UPDATE); let opt = config::LocalConfig::get_option(config::keys::OPTION_ENABLE_CHECK_UPDATE);
if config::option2bool(config::keys::OPTION_ENABLE_CHECK_UPDATE, &opt) { if config::option2bool(config::keys::OPTION_ENABLE_CHECK_UPDATE, &opt) {
std::thread::spawn(move || allow_err!(check_software_update_())); std::thread::spawn(move || allow_err!(check_software_update_()));
@ -1196,7 +1196,7 @@ pub fn pk_to_fingerprint(pk: Vec<u8>) -> String {
#[inline] #[inline]
pub async fn get_next_nonkeyexchange_msg( pub async fn get_next_nonkeyexchange_msg(
conn: &mut FramedStream, conn: &mut Stream,
timeout: Option<u64>, timeout: Option<u64>,
) -> Option<RendezvousMessage> { ) -> Option<RendezvousMessage> {
let timeout = timeout.unwrap_or(READ_TIMEOUT); let timeout = timeout.unwrap_or(READ_TIMEOUT);
@ -1265,7 +1265,7 @@ pub fn check_process(arg: &str, mut same_uid: bool) -> bool {
false false
} }
pub async fn secure_tcp(conn: &mut FramedStream, key: &str) -> ResultType<()> { pub async fn secure_tcp(conn: &mut Stream, key: &str) -> ResultType<()> {
let rs_pk = get_rs_pk(key); let rs_pk = get_rs_pk(key);
let Some(rs_pk) = rs_pk else { let Some(rs_pk) = rs_pk else {
bail!("Handshake failed: invalid public key from rendezvous server"); bail!("Handshake failed: invalid public key from rendezvous server");

View file

@ -20,10 +20,9 @@ use hbb_common::{
rendezvous_proto::*, rendezvous_proto::*,
sleep, sleep,
socket_client::{self, connect_tcp, is_ipv4}, socket_client::{self, connect_tcp, is_ipv4},
tcp::FramedStream,
tokio::{self, select, sync::Mutex, time::interval}, tokio::{self, select, sync::Mutex, time::interval},
udp::FramedSocket, udp::FramedSocket,
AddrMangle, IntoTargetAddr, ResultType, TargetAddr, AddrMangle, IntoTargetAddr, ResultType, Stream, TargetAddr,
}; };
use crate::{ use crate::{
@ -706,7 +705,7 @@ async fn direct_server(server: ServerPtr) {
enum Sink<'a> { enum Sink<'a> {
Framed(&'a mut FramedSocket, &'a TargetAddr<'a>), Framed(&'a mut FramedSocket, &'a TargetAddr<'a>),
Stream(&'a mut FramedStream), Stream(&'a mut Stream),
} }
impl Sink<'_> { impl Sink<'_> {