Rename notify_server to connect_to_server
This commit is contained in:
parent
e30ec5745e
commit
813547483f
4 changed files with 6 additions and 5 deletions
|
|
@ -10,7 +10,7 @@ pub mod utils;
|
||||||
pub mod wasm_vm;
|
pub mod wasm_vm;
|
||||||
|
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::Path;
|
||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::{collections::HashMap, fs};
|
use std::{collections::HashMap, fs};
|
||||||
|
|
@ -183,7 +183,7 @@ pub fn start(
|
||||||
let mut send_app_instructions =
|
let mut send_app_instructions =
|
||||||
SenderWithContext::new(err_ctx, SenderType::SyncSender(send_app_instructions));
|
SenderWithContext::new(err_ctx, SenderType::SyncSender(send_app_instructions));
|
||||||
|
|
||||||
os_input.notify_server();
|
os_input.connect_to_server();
|
||||||
|
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
std::panic::set_hook({
|
std::panic::set_hook({
|
||||||
|
|
|
||||||
|
|
@ -342,7 +342,7 @@ pub trait ClientOsApi: Send + Sync {
|
||||||
// This should be called from the client-side router thread only.
|
// This should be called from the client-side router thread only.
|
||||||
fn client_recv(&self) -> (ClientInstruction, ErrorContext);
|
fn client_recv(&self) -> (ClientInstruction, ErrorContext);
|
||||||
/// Setup the client IpcChannel and notify server of new client
|
/// Setup the client IpcChannel and notify server of new client
|
||||||
fn notify_server(&mut self);
|
fn connect_to_server(&mut self);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ClientOsApi for ClientOsInputOutput {
|
impl ClientOsApi for ClientOsInputOutput {
|
||||||
|
|
@ -378,7 +378,7 @@ impl ClientOsApi for ClientOsInputOutput {
|
||||||
fn update_senders(&mut self, new_ctx: ErrorContext) {
|
fn update_senders(&mut self, new_ctx: ErrorContext) {
|
||||||
self.server_sender.update(new_ctx);
|
self.server_sender.update(new_ctx);
|
||||||
}
|
}
|
||||||
fn notify_server(&mut self) {
|
fn connect_to_server(&mut self) {
|
||||||
let (client_buffer_path, client_buffer) =
|
let (client_buffer_path, client_buffer) =
|
||||||
SharedRingBuffer::create_temp(IPC_BUFFER_SIZE).unwrap();
|
SharedRingBuffer::create_temp(IPC_BUFFER_SIZE).unwrap();
|
||||||
self.client_receiver = Some(Arc::new(Mutex::new(IpcReceiver::new(
|
self.client_receiver = Some(Arc::new(Mutex::new(IpcReceiver::new(
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ pub fn main() {
|
||||||
} else if let Some(file_to_open) = opts.open_file {
|
} else if let Some(file_to_open) = opts.open_file {
|
||||||
get_client_os_input().send_to_server(ServerInstruction::OpenFile(file_to_open));
|
get_client_os_input().send_to_server(ServerInstruction::OpenFile(file_to_open));
|
||||||
} else {
|
} else {
|
||||||
|
// Mind the order: server_os_input should be created before client_os_input
|
||||||
let server_os_input = get_server_os_input();
|
let server_os_input = get_server_os_input();
|
||||||
let os_input = get_client_os_input();
|
let os_input = get_client_os_input();
|
||||||
atomic_create_dir(ZELLIJ_TMP_DIR).unwrap();
|
atomic_create_dir(ZELLIJ_TMP_DIR).unwrap();
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ impl ClientOsApi for FakeInputOutput {
|
||||||
self.server_sender.update(new_ctx);
|
self.server_sender.update(new_ctx);
|
||||||
self.client_sender.update(new_ctx);
|
self.client_sender.update(new_ctx);
|
||||||
}
|
}
|
||||||
fn notify_server(&mut self) {
|
fn connect_to_server(&mut self) {
|
||||||
ClientOsApi::send_to_server(self, ServerInstruction::NewClient("zellij".into()));
|
ClientOsApi::send_to_server(self, ServerInstruction::NewClient("zellij".into()));
|
||||||
}
|
}
|
||||||
fn client_recv(&self) -> (ClientInstruction, ErrorContext) {
|
fn client_recv(&self) -> (ClientInstruction, ErrorContext) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue