fix(plugins): do not allow attaching to the same session (#3674)
This commit is contained in:
parent
90433932bc
commit
cc04ec6ba4
1 changed files with 44 additions and 38 deletions
|
|
@ -983,6 +983,10 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
ServerInstruction::SwitchSession(mut connect_to_session, client_id) => {
|
ServerInstruction::SwitchSession(mut connect_to_session, client_id) => {
|
||||||
|
let current_session_name = envs::get_session_name();
|
||||||
|
if connect_to_session.name == current_session_name.ok() {
|
||||||
|
log::error!("Cannot attach to same session");
|
||||||
|
} else {
|
||||||
let layout_dir = session_data
|
let layout_dir = session_data
|
||||||
.read()
|
.read()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -996,7 +1000,8 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
|
||||||
if let Some(layout_dir) = layout_dir {
|
if let Some(layout_dir) = layout_dir {
|
||||||
connect_to_session.apply_layout_dir(&layout_dir);
|
connect_to_session.apply_layout_dir(&layout_dir);
|
||||||
}
|
}
|
||||||
if let Some(min_size) = session_state.read().unwrap().min_client_terminal_size() {
|
if let Some(min_size) = session_state.read().unwrap().min_client_terminal_size()
|
||||||
|
{
|
||||||
session_data
|
session_data
|
||||||
.write()
|
.write()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
@ -1029,6 +1034,7 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
|
||||||
session_state
|
session_state
|
||||||
);
|
);
|
||||||
remove_client!(client_id, os_input, session_state);
|
remove_client!(client_id, os_input, session_state);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
ServerInstruction::AssociatePipeWithClient { pipe_id, client_id } => {
|
ServerInstruction::AssociatePipeWithClient { pipe_id, client_id } => {
|
||||||
session_state
|
session_state
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue