Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Dec 7, 2024
1 parent 1e9e262 commit 1cc4484
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/ipc/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ pub async fn listen() -> Result<interprocess::local_socket::tokio::Listener> {
}

fn fs_name(path: &Path) -> Result<Name> {
let fs_name = path.clone().to_fs_name::<GenericFilePath>()?;
let fs_name = path.to_fs_name::<GenericFilePath>()?;
Ok(fs_name)
}
13 changes: 7 additions & 6 deletions src/supervisor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@ use crate::state_file::{DaemonStatus, StateFile, StateFileDaemon};
use crate::{env, ipc, Result};
use duct::cmd;
use interprocess::local_socket::tokio::prelude::*;
use interprocess::local_socket::{GenericFilePath, ListenerOptions};
use interprocess::local_socket::tokio::Listener;
use notify_debouncer_mini::{new_debouncer, notify::*, DebounceEventResult, Debouncer};
use std::path::PathBuf;
use std::process::exit;
use std::sync::atomic;
use std::sync::atomic::AtomicBool;
use std::time::Duration;
use interprocess::local_socket::tokio::Listener;
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
#[cfg(unix)]
use tokio::signal::unix::SignalKind;
use tokio::sync::mpsc::{channel, Receiver, Sender};
use tokio::{fs, select, signal, time, try_join};
use tokio::sync::mpsc::{channel, Sender};
use tokio::{signal, time, try_join};

pub struct Supervisor {
state_file: StateFile,
Expand Down Expand Up @@ -186,7 +185,7 @@ impl Supervisor {
});
Ok(())
}

fn conn_watch(&self, listener: Listener, tx: Sender<Event>) -> Result<()> {
tokio::spawn(async move {
loop {
Expand All @@ -204,7 +203,9 @@ impl Supervisor {
let recv = recv.read_line(&mut buffer);
match try_join!(send, recv) {
Ok(_) => {
tx.send(Event::Conn(buffer.trim().to_string())).await.unwrap();
tx.send(Event::Conn(buffer.trim().to_string()))
.await
.unwrap();
}
Err(e) => {
error!("failed to read/write: {:?}", e);
Expand Down

0 comments on commit 1cc4484

Please sign in to comment.