diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-09-18 18:24:01 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-09-18 18:24:01 +0800 |
| commit | 0798c029cee16875fb09ea6a158dbab2dcf13aab (patch) | |
| tree | 9b0497b3aca80d22d0ecfc7c246985c0c64126b4 | |
| parent | 13ddbc480915b7b8266eceb1305164803a713b04 (diff) | |
client: disable SIGIGN for all signals when built in debug
| -rw-r--r-- | src/client/main.rs | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/src/client/main.rs b/src/client/main.rs index fa2017d..be37341 100644 --- a/src/client/main.rs +++ b/src/client/main.rs @@ -3,7 +3,9 @@ use crate::client::Client; use crate::connector::httpconnector::HTTPConnector; +#[cfg(not(debug_assertions))] use signal_hook::consts::signal::*; +#[cfg(not(debug_assertions))] use signal_hook::iterator::Signals; pub(crate) mod client; @@ -11,33 +13,36 @@ pub(crate) mod connector; pub(crate) mod executor; fn main() { - _ = Signals::new([ - SIGHUP, - SIGINT, - SIGQUIT, - SIGTRAP, - SIGABRT, - SIGPIPE, - SIGALRM, - SIGTERM, - SIGUSR1, - SIGUSR2, - SIGCHLD, - SIGCONT, - SIGTSTP, - SIGTTIN, - SIGTTOU, - SIGURG, - SIGXCPU, - SIGXFSZ, - SIGVTALRM, - SIGPROF, - SIGWINCH, - #[cfg(any(target_os = "linux", target_os = "android"))] - SIGSYS, - ]); // discard err + #[cfg(not(debug_assertions))] + { + _ = Signals::new([ + SIGHUP, + SIGINT, + SIGQUIT, + SIGTRAP, + SIGABRT, + SIGPIPE, + SIGALRM, + SIGTERM, + SIGUSR1, + SIGUSR2, + SIGCHLD, + SIGCONT, + SIGTSTP, + SIGTTIN, + SIGTTOU, + SIGURG, + SIGXCPU, + SIGXFSZ, + SIGVTALRM, + SIGPROF, + SIGWINCH, + #[cfg(any(target_os = "linux", target_os = "android"))] + SIGSYS, + ]); // discard err + } - let ip = "http://127.0.0.1:8080"; + let ip = "http://127.0.0.1:8081"; let client = Client::new(HTTPConnector::new(ip, ip, "/").unwrap()).unwrap(); client.enter_loop(); } |
