- Removed unused structs and methods from `response.rs`, `usage.rs`, and `client.rs`. - Simplified `Connection` handling in `conn.rs` to only support Unix sockets. - Updated `IpcServer` to exclusively use Unix sockets and removed TCP handling. - Cleaned up `editlog.rs` by removing loading and recent entry methods. - Refactored `memory.rs` to eliminate unused functions related to lesson promotion and retrospective creation. - Enhanced `search.rs` to support multiple search providers and improved error handling. - Updated chat view logic to simplify message display and improve user experience. - Removed deprecated modules and constants from various files to streamline the codebase.
21 lines
498 B
Rust
21 lines
498 B
Rust
use std::os::unix::net::UnixListener;
|
|
use anyhow::Result;
|
|
use super::conn::Connection;
|
|
|
|
pub struct IpcServer {
|
|
listener: UnixListener,
|
|
}
|
|
|
|
impl IpcServer {
|
|
pub fn bind_unix(path: &str) -> Result<Self> {
|
|
let _ = std::fs::remove_file(path);
|
|
let listener = UnixListener::bind(path)?;
|
|
Ok(IpcServer { listener })
|
|
}
|
|
|
|
pub fn accept(&self) -> Result<Connection> {
|
|
let (stream, _addr) = self.listener.accept()?;
|
|
Connection::from_stream(stream)
|
|
}
|
|
}
|