fix(attach): make removing clients atomic (#966)
This commit is contained in:
parent
3f2724dc07
commit
0d7f22f09a
2 changed files with 49 additions and 55 deletions
|
|
@ -5,7 +5,7 @@ expression: last_snapshot
|
|||
---
|
||||
Zellij (e2e-test) Tab #1
|
||||
┌ Pane #1 ─────────────────────────────────────────────────┐┌ Pane #2 ─────────────────────────────────────────────────┐
|
||||
│$ ││$ I am some text█ │
|
||||
│$ █ ││$ I am some text │
|
||||
│ ││ │
|
||||
│ ││ │
|
||||
│ ││ │
|
||||
|
|
|
|||
|
|
@ -386,25 +386,23 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
|
|||
.senders
|
||||
.send_to_screen(ScreenInstruction::TerminalResize(min_size))
|
||||
.unwrap();
|
||||
// we only do this inside this if because it means there are still connected
|
||||
// clients
|
||||
session_data
|
||||
.write()
|
||||
.unwrap()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.senders
|
||||
.send_to_screen(ScreenInstruction::RemoveClient(client_id))
|
||||
.unwrap();
|
||||
session_data
|
||||
.write()
|
||||
.unwrap()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.senders
|
||||
.send_to_plugin(PluginInstruction::RemoveClient(client_id))
|
||||
.unwrap();
|
||||
}
|
||||
session_data
|
||||
.write()
|
||||
.unwrap()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.senders
|
||||
.send_to_screen(ScreenInstruction::RemoveClient(client_id))
|
||||
.unwrap();
|
||||
session_data
|
||||
.write()
|
||||
.unwrap()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.senders
|
||||
.send_to_plugin(PluginInstruction::RemoveClient(client_id))
|
||||
.unwrap();
|
||||
if session_state.read().unwrap().clients.is_empty() {
|
||||
*session_data.write().unwrap() = None;
|
||||
break;
|
||||
|
|
@ -421,25 +419,23 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
|
|||
.senders
|
||||
.send_to_screen(ScreenInstruction::TerminalResize(min_size))
|
||||
.unwrap();
|
||||
// we only do this inside this if because it means there are still connected
|
||||
// clients
|
||||
session_data
|
||||
.write()
|
||||
.unwrap()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.senders
|
||||
.send_to_screen(ScreenInstruction::RemoveClient(client_id))
|
||||
.unwrap();
|
||||
session_data
|
||||
.write()
|
||||
.unwrap()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.senders
|
||||
.send_to_plugin(PluginInstruction::RemoveClient(client_id))
|
||||
.unwrap();
|
||||
}
|
||||
session_data
|
||||
.write()
|
||||
.unwrap()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.senders
|
||||
.send_to_screen(ScreenInstruction::RemoveClient(client_id))
|
||||
.unwrap();
|
||||
session_data
|
||||
.write()
|
||||
.unwrap()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.senders
|
||||
.send_to_plugin(PluginInstruction::RemoveClient(client_id))
|
||||
.unwrap();
|
||||
}
|
||||
ServerInstruction::KillSession => {
|
||||
let client_ids = session_state.read().unwrap().client_ids();
|
||||
|
|
@ -461,25 +457,23 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
|
|||
.senders
|
||||
.send_to_screen(ScreenInstruction::TerminalResize(min_size))
|
||||
.unwrap();
|
||||
// we only do this inside this if because it means there are still connected
|
||||
// clients
|
||||
session_data
|
||||
.write()
|
||||
.unwrap()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.senders
|
||||
.send_to_screen(ScreenInstruction::RemoveClient(client_id))
|
||||
.unwrap();
|
||||
session_data
|
||||
.write()
|
||||
.unwrap()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.senders
|
||||
.send_to_plugin(PluginInstruction::RemoveClient(client_id))
|
||||
.unwrap();
|
||||
}
|
||||
session_data
|
||||
.write()
|
||||
.unwrap()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.senders
|
||||
.send_to_screen(ScreenInstruction::RemoveClient(client_id))
|
||||
.unwrap();
|
||||
session_data
|
||||
.write()
|
||||
.unwrap()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.senders
|
||||
.send_to_plugin(PluginInstruction::RemoveClient(client_id))
|
||||
.unwrap();
|
||||
}
|
||||
ServerInstruction::Render(mut output) => {
|
||||
let client_ids = session_state.read().unwrap().client_ids();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue