From 6f1597b1e713ba7824aeddc8ef3a96db7a24323a Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 13 May 2022 14:50:29 +0800 Subject: [PATCH] make "fountain" test optionally terminate any characters typed as an argument after "fountain" will cause it to terminate in 10 iterations --- services/shellchat/src/cmds/net_cmd.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/services/shellchat/src/cmds/net_cmd.rs b/services/shellchat/src/cmds/net_cmd.rs index a115124ba..3cdffe2bb 100644 --- a/services/shellchat/src/cmds/net_cmd.rs +++ b/services/shellchat/src/cmds/net_cmd.rs @@ -139,7 +139,6 @@ impl<'a> ShellCmdApi<'a> for NetCmd { let bi = boot_instant.clone(); move || { handle_connection(stream, bi); - log::info!("connection closed"); } }); } @@ -150,7 +149,10 @@ impl<'a> ShellCmdApi<'a> for NetCmd { write!(ret, "TCP listener started on port 80").unwrap(); } "fountain" => { + // anything typed after fountain will cause this to be a short test + let short_test = tokens.next().is_some(); thread::spawn({ + let short_test = short_test.clone(); move || { let tp = threadpool::ThreadPool::new(4); loop { @@ -180,7 +182,7 @@ impl<'a> ShellCmdApi<'a> for NetCmd { _ => {} } count += 1; - if count == 10 { + if count == 10 && short_test { stream.flush().unwrap(); break; } @@ -538,7 +540,7 @@ impl Worker { match message { Message::NewJob(job) => { - log::info!("Worker {} got a job; executing.", id); + log::debug!("Worker {} got a job; executing.", id); job(); }