Commit 6c413538 by qlintonger xeno

cancel-call和call成功,但是出现死锁问题,卡顿在step - 0这里 ==> 已解决

parent a8e1f401
...@@ -118,12 +118,13 @@ pub async fn handle_agora_call( ...@@ -118,12 +118,13 @@ pub async fn handle_agora_call(
} }
let the_other_caller = { ONLINE_USERS.get(&to_hangup_id) }; let the_other_caller = { ONLINE_USERS.get(&to_hangup_id) };
// 获取当前用户状态信息成功后,再进行额外操作 // 获取当前用户状态信息成功后,再进行额外操作
if let Some(the_other_caller_data) = the_other_caller { if let Some(ref the_other_caller_data) = the_other_caller {
let mut the_other_caller_data: Vec<String> = the_other_caller_data let mut the_other_caller_data: Vec<String> = the_other_caller_data
.split(',') .split(',')
.map(|s| s.to_string()) .map(|s| s.to_string())
.collect(); .collect();
// 提前释放 // 提前释放
drop(the_other_caller);
// 如果处于同一频道,则发送挂断信息, // 如果处于同一频道,则发送挂断信息,
if the_other_caller_data[1] == the_current_user_data[1] { if the_other_caller_data[1] == the_current_user_data[1] {
let hangup_message_json = serde_json::json!({ let hangup_message_json = serde_json::json!({
...@@ -186,6 +187,7 @@ pub async fn handle_agora_call( ...@@ -186,6 +187,7 @@ pub async fn handle_agora_call(
the_current_user_data[0] = "idle".to_string(); the_current_user_data[0] = "idle".to_string();
the_current_user_data[6] = "0".to_string(); the_current_user_data[6] = "0".to_string();
let the_current_data_joined = the_current_user_data.join(",").to_string(); let the_current_data_joined = the_current_user_data.join(",").to_string();
drop(user_status);
drop(the_current_user_data); drop(the_current_user_data);
println!("step - 1.7"); println!("step - 1.7");
ONLINE_USERS.insert( ONLINE_USERS.insert(
...@@ -580,7 +582,7 @@ pub async fn handle_agora_call( ...@@ -580,7 +582,7 @@ pub async fn handle_agora_call(
} }
_ = cancel_rx.recv() => { _ = cancel_rx.recv() => {
// 线程被取消 // 线程被取消
println!("用户已接听或者主动挂断 {}", user_id_clone); println!("用户已接听或者主动挂断或者通话被取消 {}", user_id_clone);
} }
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment