Skip to content

Commit 69af021

Browse files
authored
Merge pull request #20 from ionut-arm/reorg
Refactor low level clients
2 parents 8786219 + 7b8b905 commit 69af021

File tree

11 files changed

+633
-604
lines changed

11 files changed

+633
-604
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ categories = ["development-tools"]
1212
edition = "2018"
1313

1414
[dependencies]
15-
parsec-interface = "0.11.0"
15+
parsec-interface = "0.13.0"
1616
num = "0.2.1"
1717
rand = "0.7.3"
1818
log = "0.4.8"

src/core/basic_client.rs

Lines changed: 495 additions & 0 deletions
Large diffs are not rendered by default.
File renamed without changes.

src/core/ipc_client/unix_socket.rs renamed to src/core/ipc_handler/unix_socket.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ use std::time::Duration;
1010
const DEFAULT_SOCKET_PATH: &str = "/tmp/security-daemon-socket";
1111
const DEFAULT_TIMEOUT: Duration = Duration::from_secs(1);
1212

13-
/// IPC client for Unix domain sockets
13+
/// IPC handler for Unix domain sockets
1414
#[derive(Debug, Clone)]
15-
pub struct Client {
15+
pub struct Handler {
1616
/// Path at which the socket can be found
1717
path: PathBuf,
1818
/// Timeout for reads and writes on the streams
1919
timeout: Option<Duration>,
2020
}
2121

22-
impl Connect for Client {
22+
impl Connect for Handler {
2323
fn connect(&self) -> Result<Box<dyn ReadWrite>> {
2424
let stream = UnixStream::connect(self.path.clone()).map_err(ClientErrorKind::Ipc)?;
2525

@@ -34,16 +34,16 @@ impl Connect for Client {
3434
}
3535
}
3636

37-
impl Client {
37+
impl Handler {
3838
/// Create new client using given socket path and timeout duration
3939
pub fn new(path: PathBuf, timeout: Option<Duration>) -> Self {
40-
Client { path, timeout }
40+
Handler { path, timeout }
4141
}
4242
}
4343

44-
impl Default for Client {
44+
impl Default for Handler {
4545
fn default() -> Self {
46-
Client {
46+
Handler {
4747
path: DEFAULT_SOCKET_PATH.into(),
4848
timeout: Some(DEFAULT_TIMEOUT),
4949
}

0 commit comments

Comments
 (0)