refact, flutter sessions lock

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-10-03 09:51:21 +08:00
parent b02f169764
commit 06987c4ca9
9 changed files with 188 additions and 170 deletions

View File

@@ -75,15 +75,15 @@ impl Interface for Session {
}
}
fn handle_login_error(&mut self, err: &str) -> bool {
fn handle_login_error(&self, err: &str) -> bool {
handle_login_error(self.lc.clone(), err, self)
}
fn handle_peer_info(&mut self, pi: PeerInfo) {
fn handle_peer_info(&self, pi: PeerInfo) {
self.lc.write().unwrap().handle_peer_info(&pi);
}
async fn handle_hash(&mut self, pass: &str, hash: Hash, peer: &mut Stream) {
async fn handle_hash(&self, pass: &str, hash: Hash, peer: &mut Stream) {
log::info!(
"password={}",
hbb_common::password_security::temporary_password()
@@ -92,7 +92,7 @@ impl Interface for Session {
}
async fn handle_login_from_ui(
&mut self,
&self,
os_username: String,
os_password: String,
password: String,
@@ -110,7 +110,7 @@ impl Interface for Session {
.await;
}
async fn handle_test_delay(&mut self, t: TestDelay, peer: &mut Stream) {
async fn handle_test_delay(&self, t: TestDelay, peer: &mut Stream) {
handle_test_delay(t, peer).await;
}