fix: close notify

This commit is contained in:
Kingtous 2023-02-07 16:53:46 +08:00
parent fc933ad7b4
commit cd6cdbff8f
2 changed files with 4 additions and 2 deletions

@ -1264,7 +1264,7 @@ impl<T: InvokeUiSession> Remote<T> {
self.stop_voice_call_sender = self.start_voice_call(); self.stop_voice_call_sender = self.start_voice_call();
} else { } else {
// The peer refused the voice call. // The peer refused the voice call.
self.handler.on_voice_call_closed("Refused"); self.handler.on_voice_call_closed("");
} }
} }
} }

@ -1614,7 +1614,6 @@ impl Connection {
pub async fn handle_voice_call(&mut self, accepted: bool) { pub async fn handle_voice_call(&mut self, accepted: bool) {
if let Some(ts) = self.voice_call_request_timestamp.take() { if let Some(ts) = self.voice_call_request_timestamp.take() {
let msg = new_voice_call_response(ts.get(), accepted); let msg = new_voice_call_response(ts.get(), accepted);
self.send(msg).await;
if accepted { if accepted {
// Backup the default input device. // Backup the default input device.
let audio_input_device = Config::get_option("audio-input"); let audio_input_device = Config::get_option("audio-input");
@ -1625,7 +1624,10 @@ impl Connection {
set_sound_input(device); set_sound_input(device);
} }
self.send_to_cm(Data::StartVoiceCall); self.send_to_cm(Data::StartVoiceCall);
} else {
self.send_to_cm(Data::CloseVoiceCall("".to_owned()));
} }
self.send(msg).await;
} else { } else {
log::warn!("Possible a voice call attack."); log::warn!("Possible a voice call attack.");
} }