mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 21:32:13 +03:00
add very bare bones skeleton for unix domain socket bits
This commit is contained in:
parent
8fa619d23f
commit
d71ac26b93
@ -39,6 +39,9 @@ path = "term"
|
||||
[dependencies.termwiz]
|
||||
path = "termwiz"
|
||||
|
||||
[target."cfg(windows)".dependencies.uds_windows]
|
||||
version = "0.1"
|
||||
|
||||
[target."cfg(windows)".dependencies.winapi]
|
||||
features = [
|
||||
"winuser",
|
||||
|
@ -22,6 +22,7 @@ mod guicommon;
|
||||
mod guiloop;
|
||||
mod mux;
|
||||
mod opengl;
|
||||
mod server;
|
||||
use crate::guicommon::tabs::Tab;
|
||||
use crate::guiloop::GuiSelection;
|
||||
use crate::guiloop::GuiSystem;
|
||||
|
1
src/server/client.rs
Normal file
1
src/server/client.rs
Normal file
@ -0,0 +1 @@
|
||||
pub struct Client {}
|
33
src/server/listener.rs
Normal file
33
src/server/listener.rs
Normal file
@ -0,0 +1,33 @@
|
||||
use crate::server::{UnixListener, UnixStream};
|
||||
use failure::Error;
|
||||
use std::io::{Read, Write};
|
||||
|
||||
pub trait SocketLike: Read + Write + Send {}
|
||||
|
||||
pub trait Acceptor {
|
||||
fn accept(&self) -> Result<Box<SocketLike>, Error>;
|
||||
}
|
||||
|
||||
impl SocketLike for UnixStream {}
|
||||
|
||||
impl Acceptor for UnixListener {
|
||||
fn accept(&self) -> Result<Box<SocketLike>, Error> {
|
||||
let (stream, _addr) = UnixListener::accept(self)?;
|
||||
let timeout = std::time::Duration::new(60, 0);
|
||||
stream.set_read_timeout(Some(timeout))?;
|
||||
stream.set_write_timeout(Some(timeout))?;
|
||||
Ok(Box::new(stream))
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Listener {
|
||||
acceptor: Box<Acceptor>,
|
||||
}
|
||||
|
||||
impl Listener {
|
||||
pub fn new(acceptor: Box<Acceptor>) -> Self {
|
||||
Self { acceptor }
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ClientSession {}
|
7
src/server/mod.rs
Normal file
7
src/server/mod.rs
Normal file
@ -0,0 +1,7 @@
|
||||
#[cfg(unix)]
|
||||
use std::os::unix::net::{SocketAddr, UnixListener, UnixStream};
|
||||
#[cfg(windows)]
|
||||
use uds_windows::{SocketAddr, UnixListener, UnixStream};
|
||||
|
||||
pub mod client;
|
||||
pub mod listener;
|
Loading…
Reference in New Issue
Block a user