about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authoryuzu <yuzu@b9215c17-b818-4693-b096-d1e41a411fef>2025-07-09 05:32:04 +0000
committeryuzu <yuzu@b9215c17-b818-4693-b096-d1e41a411fef>2025-07-09 05:32:04 +0000
commitb2cf95ed207e42d1f57de1e5b5030af8c734103b (patch)
tree805f92f0905de4af59e5a897b14c4392aa3cd0dc
parentdb05108dfaa14044c187d45fc6c9fc479d82b6d0 (diff)
downloadsalaryman-b2cf95ed207e42d1f57de1e5b5030af8c734103b.tar.gz
salaryman-b2cf95ed207e42d1f57de1e5b5030af8c734103b.tar.bz2
salaryman-b2cf95ed207e42d1f57de1e5b5030af8c734103b.zip
fix bug in service::Service; run fmt
git-svn-id: svn+ssh://diminuette.aengel.lesbianunix.dev/salaryman/trunk@12 b9215c17-b818-4693-b096-d1e41a411fef
-rw-r--r--src/service.rs6
-rw-r--r--src/smd/main.rs26
2 files changed, 15 insertions, 17 deletions
diff --git a/src/service.rs b/src/service.rs
index 60960e3..b42daba 100644
--- a/src/service.rs
+++ b/src/service.rs
@@ -138,6 +138,8 @@ impl Service {
             lock.kill().await?;
             drop(lock);
             self.proc = None;
+            self.stdout = None;
+            self.stderr = None;
             Ok(())
         } else {
             Err(Box::new(std::io::Error::new(
@@ -170,7 +172,7 @@ impl Service {
                 )));
             };
             drop(lock);
-            let (tx, rx) = channel(100);
+            let (tx, rx) = channel(1024);
             let sname = self.conf.name.clone();
             spawn(async move {
                 let mut br = BufReader::new(stdout).lines();
@@ -206,7 +208,7 @@ impl Service {
                 )));
             };
             drop(lock);
-            let (tx, rx) = channel(100);
+            let (tx, rx) = channel(1024);
             let sname = self.conf.name.clone();
             spawn(async move {
                 let mut br = BufReader::new(stderr).lines();
diff --git a/src/smd/main.rs b/src/smd/main.rs
index 231701b..fee2d9e 100644
--- a/src/smd/main.rs
+++ b/src/smd/main.rs
@@ -1,9 +1,9 @@
 mod endpoints;
 
 use clap::Parser;
+use salaryman::service::{Service, ServiceConf};
 use serde::{Deserialize, Serialize};
 use tokio::fs::read_to_string;
-use salaryman::service::{Service, ServiceConf};
 
 use std::{net::IpAddr, path::PathBuf};
 
@@ -42,26 +42,23 @@ struct Config {
     port: Option<u16>,
     service: Vec<ServiceConf>,
 }
-/*
-impl Config {
-    fn new() -> Self {
-        Self {
-            address: None,
-            port: None,
-            service: Vec::new(),
-        }
-    }
-}
-*/
 
 async fn load_config(file: &PathBuf) -> Result<Config, Box<dyn std::error::Error>> {
     let s: String = match read_to_string(file).await {
         Ok(s) => s,
-        Err(_) => return Err(Box::new(std::io::Error::new(std::io::ErrorKind::NotFound, "cannot find config file"))),
+        Err(_) => {
+            return Err(Box::new(std::io::Error::new(
+                std::io::ErrorKind::NotFound,
+                "cannot find config file",
+            )));
+        }
     };
     match toml::from_str(s.as_str()) {
         Ok(c) => Ok(c),
-        Err(_) => Err(Box::new(std::io::Error::new(std::io::ErrorKind::Other, "unable to parse config file"))),
+        Err(_) => Err(Box::new(std::io::Error::new(
+            std::io::ErrorKind::Other,
+            "unable to parse config file",
+        ))),
     }
 }
 
@@ -92,4 +89,3 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
     }
     Ok(())
 }
-