diff options
| author | Kunal Mohan <kunalmohan99@gmail.com> | 2021-03-22 09:05:08 +0530 |
|---|---|---|
| committer | Kunal Mohan <kunalmohan99@gmail.com> | 2021-05-04 20:47:52 +0530 |
| commit | 660434be06b14b44059db852c9c26e09b027f619 (patch) | |
| tree | 62110947245b4f7b1b6470b23e1460e5c6fe07c9 /src/common | |
| parent | Hide server-side Ipc channels creation behind OsApis and some documentation f... (diff) | |
| download | sl0ppij-660434be06b14b44059db852c9c26e09b027f619.tar.gz sl0ppij-660434be06b14b44059db852c9c26e09b027f619.tar.xz sl0ppij-660434be06b14b44059db852c9c26e09b027f619.zip | |
documentation and nit fix
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/mod.rs | 4 | ||||
| -rw-r--r-- | src/common/os_input_output.rs | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/common/mod.rs b/src/common/mod.rs index ec1f0959..9a7e40e4 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -164,7 +164,7 @@ impl IpcSenderWithContext { } pub fn send<T: Serialize>(&mut self, msg: T) -> ipmpsc::Result<()> { - self.sender.send(&(self.err_ctx, msg)) + self.sender.send(&(msg, self.err_ctx)) } } @@ -573,7 +573,7 @@ pub fn start( .spawn({ let recv_client_instructions = IpcReceiver::new(client_buffer); move || loop { - let (err_ctx, instruction): (ErrorContext, ClientInstruction) = + let (instruction, err_ctx): (ClientInstruction, ErrorContext) = recv_client_instructions.recv().unwrap(); send_app_instructions.update(err_ctx); match instruction { diff --git a/src/common/os_input_output.rs b/src/common/os_input_output.rs index 90bd0e49..b97834b5 100644 --- a/src/common/os_input_output.rs +++ b/src/common/os_input_output.rs @@ -180,7 +180,10 @@ pub trait ServerOsApi: Send + Sync { fn kill(&mut self, pid: RawFd) -> Result<(), nix::Error>; /// Returns a [`Box`] pointer to this [`OsApi`] struct. fn box_clone(&self) -> Box<dyn ServerOsApi>; + /// Returns the receiver of ServerInstructions. + // Should be called by server once only. fn get_server_receiver(&self) -> IpcReceiver; + /// Returns a sender to the Server. fn get_server_sender(&self) -> IpcSenderWithContext; } @@ -264,6 +267,7 @@ pub trait ClientOsApi: Send + Sync { fn read_from_stdin(&self) -> Vec<u8>; /// Returns a [`Box`] pointer to this [`OsApi`] struct. fn box_clone(&self) -> Box<dyn ClientOsApi>; + /// Returns a sender to the Server. fn get_server_sender(&self) -> IpcResult<IpcSenderWithContext>; } |
