handle peer event

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-04-19 17:06:59 +08:00
parent c8be2016f1
commit f7e2938e6b
9 changed files with 242 additions and 34 deletions

View File

@@ -311,7 +311,8 @@ impl<T: InvokeUiSession> Remote<T> {
{
// Create a channel to receive error or closed message
let (tx, rx) = std::sync::mpsc::channel();
let (tx_audio_data, mut rx_audio_data) = hbb_common::tokio::sync::mpsc::unbounded_channel();
let (tx_audio_data, mut rx_audio_data) =
hbb_common::tokio::sync::mpsc::unbounded_channel();
// Create a stand-alone inner, add subscribe to audio service
let conn_id = CLIENT_SERVER.write().unwrap().get_new_id();
let client_conn_inner = ConnInner::new(conn_id.clone(), Some(tx_audio_data), None);
@@ -1297,6 +1298,22 @@ impl<T: InvokeUiSession> Remote<T> {
#[cfg(feature = "flutter")]
self.handler.switch_back(&self.handler.id);
}
#[cfg(all(feature = "flutter", feature = "plugin_framework"))]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
Some(misc::Union::PluginRequest(p)) => {
allow_err!(crate::plugin::handle_server_event(&p.id, &p.content));
// to-do: show message box on UI when error occurs?
}
#[cfg(all(feature = "flutter", feature = "plugin_framework"))]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
Some(misc::Union::PluginResponse(p)) => {
let name = if p.name.is_empty() {
"plugin".to_string()
} else {
p.name
};
self.handler.msgbox("custom-nocancel", &name, &p.msg, "");
}
_ => {}
},
Some(message::Union::TestDelay(t)) => {