mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-25 13:19:04 +08:00
release session stream after close
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
6e12e77f51
commit
d5502f58ef
@ -1368,6 +1368,9 @@ class FFI {
|
||||
// Preserved for the rgba data.
|
||||
await for (final message in stream) {
|
||||
if (message is EventToUI_Event) {
|
||||
if (message.field0 == "close") {
|
||||
break;
|
||||
}
|
||||
try {
|
||||
Map<String, dynamic> event = json.decode(message.field0);
|
||||
await cb(event);
|
||||
|
@ -132,6 +132,9 @@ pub fn session_login(id: String, password: String, remember: bool) {
|
||||
|
||||
pub fn session_close(id: String) {
|
||||
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
|
||||
if let Some(stream) = &*session.event_stream.read().unwrap() {
|
||||
stream.add(EventToUI::Event("close".to_owned()));
|
||||
}
|
||||
session.close();
|
||||
}
|
||||
let _ = SESSIONS.write().unwrap().remove(&id);
|
||||
|
Loading…
Reference in New Issue
Block a user