mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
fix, separate window, event stream leak
Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
@@ -1093,16 +1093,28 @@ pub fn push_global_event(channel: &str, event: String) -> Option<bool> {
|
||||
Some(GLOBAL_EVENT_STREAM.read().unwrap().get(channel)?.add(event))
|
||||
}
|
||||
|
||||
pub fn start_global_event_stream(s: StreamSink<String>, app_type: String) -> ResultType<()> {
|
||||
if let Some(_) = GLOBAL_EVENT_STREAM
|
||||
.write()
|
||||
#[inline]
|
||||
pub fn get_global_event_channels() -> Vec<String> {
|
||||
GLOBAL_EVENT_STREAM
|
||||
.read()
|
||||
.unwrap()
|
||||
.insert(app_type.clone(), s)
|
||||
{
|
||||
log::warn!(
|
||||
"Global event stream of type {} is started before, but now removed",
|
||||
app_type
|
||||
);
|
||||
.keys()
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn start_global_event_stream(s: StreamSink<String>, app_type: String) -> ResultType<()> {
|
||||
let app_type_values = app_type.split(",").collect::<Vec<&str>>();
|
||||
let mut lock = GLOBAL_EVENT_STREAM.write().unwrap();
|
||||
if !lock.contains_key(app_type_values[0]) {
|
||||
lock.insert(app_type.clone(), s);
|
||||
} else {
|
||||
if let Some(_) = lock.insert(app_type.clone(), s) {
|
||||
log::warn!(
|
||||
"Global event stream of type {} is started before, but now removed",
|
||||
app_type
|
||||
);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user