diff options
| author | Kunal Mohan <kunalmohan99@gmail.com> | 2021-04-29 16:27:14 +0530 |
|---|---|---|
| committer | Kunal Mohan <kunalmohan99@gmail.com> | 2021-05-04 20:48:16 +0530 |
| commit | 1eb732773aa583305353a1e63ffbac879f29f2d8 (patch) | |
| tree | 151dffd48d06de2cc9f06cf79dcd89187a8f94a0 /src/common | |
| parent | remove Split, OpenFile and MoveFocus from CliArgs (diff) | |
| download | sl0ppij-1eb732773aa583305353a1e63ffbac879f29f2d8.tar.gz sl0ppij-1eb732773aa583305353a1e63ffbac879f29f2d8.tar.xz sl0ppij-1eb732773aa583305353a1e63ffbac879f29f2d8.zip | |
use Uuid to generate unique server socket names
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/mod.rs | 7 | ||||
| -rw-r--r-- | src/common/os_input_output.rs | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/common/mod.rs b/src/common/mod.rs index 6061f1a6..4baf503f 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -11,8 +11,10 @@ pub mod wasm_vm; use crate::panes::PaneId; use crate::server::ServerInstruction; +use crate::utils::consts::ZELLIJ_IPC_PIPE; use async_std::task_local; use errors::{get_current_ctx, ErrorContext}; +use lazy_static::lazy_static; use std::cell::RefCell; use std::sync::mpsc; @@ -73,3 +75,8 @@ task_local! { /// stack in the form of an [`ErrorContext`]. static ASYNCOPENCALLS: RefCell<ErrorContext> = RefCell::default() } + +lazy_static! { + pub static ref UNIQUE_ZELLIJ_IPC_PIPE: String = + ZELLIJ_IPC_PIPE.to_string() + uuid::Uuid::new_v4().to_string().as_str(); +} diff --git a/src/common/os_input_output.rs b/src/common/os_input_output.rs index a99a0d16..d8ef45f9 100644 --- a/src/common/os_input_output.rs +++ b/src/common/os_input_output.rs @@ -17,10 +17,10 @@ use std::process::{Child, Command}; use std::sync::{Arc, Mutex}; use crate::client::ClientInstruction; +use crate::common::UNIQUE_ZELLIJ_IPC_PIPE; use crate::errors::{get_current_ctx, ErrorContext}; use crate::panes::PositionAndSize; use crate::server::ServerInstruction; -use crate::utils::consts::ZELLIJ_IPC_PIPE; const IPC_BUFFER_SIZE: usize = 262144; @@ -404,7 +404,7 @@ impl ClientOsApi for ClientOsInputOutput { } } fn connect_to_server(&self) { - let socket = LocalSocketStream::connect(ZELLIJ_IPC_PIPE).unwrap(); + let socket = LocalSocketStream::connect(UNIQUE_ZELLIJ_IPC_PIPE.as_str()).unwrap(); let sock_fd = socket.as_raw_fd(); let dup_fd = unistd::dup(sock_fd).unwrap(); let receiver = unsafe { LocalSocketStream::from_raw_fd(dup_fd) }; |
