hosted: cutting down on println messages

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2020-06-23 16:40:51 +08:00
parent cbd8ec3a30
commit 04faa898c7
2 changed files with 12 additions and 16 deletions

View file

@ -50,10 +50,10 @@ fn handle_connection(mut conn: TcpStream, pid: PID, chn: Sender<(PID, SysCall)>)
match call { match call {
Err(e) => println!("Received invalid syscall: {:?}", e), Err(e) => println!("Received invalid syscall: {:?}", e),
Ok(call) => { Ok(call) => {
println!( // println!(
"Received packet: {:08x} {} {} {} {} {} {} {}: {:?}", // "Received packet: {:08x} {} {} {} {} {} {} {}: {:?}",
pkt[0], pkt[1], pkt[2], pkt[3], pkt[4], pkt[5], pkt[6], pkt[7], call // pkt[0], pkt[1], pkt[2], pkt[3], pkt[4], pkt[5], pkt[6], pkt[7], call
); // );
chn.send((pid, call)).expect("couldn't make syscall"); chn.send((pid, call)).expect("couldn't make syscall");
} }
} }
@ -78,7 +78,6 @@ fn listen_thread(address: Option<String>, chn: Sender<(PID, SysCall)>, quit: Rec
loop { loop {
match listener.accept() { match listener.accept() {
Ok((conn, addr)) => { Ok((conn, addr)) => {
println!("New client connected from {}", addr);
let thr_chn = chn.clone(); let thr_chn = chn.clone();
let new_pid = { let new_pid = {
@ -86,7 +85,7 @@ fn listen_thread(address: Option<String>, chn: Sender<(PID, SysCall)>, quit: Rec
ss.spawn_process(process::ProcessInit::new(conn.try_clone().unwrap()), ()) ss.spawn_process(process::ProcessInit::new(conn.try_clone().unwrap()), ())
.unwrap() .unwrap()
}; };
println!("Assigned PID {}", new_pid); println!("New client connected from {} and assigned PID {}", addr, new_pid);
let conn_copy = conn.try_clone().expect("couldn't duplicate connection"); let conn_copy = conn.try_clone().expect("couldn't duplicate connection");
let jh = spawn(move || handle_connection(conn, new_pid, thr_chn)); let jh = spawn(move || handle_connection(conn, new_pid, thr_chn));
clients.push((jh, conn_copy)); clients.push((jh, conn_copy));
@ -97,14 +96,11 @@ fn listen_thread(address: Option<String>, chn: Sender<(PID, SysCall)>, quit: Rec
continue; continue;
} }
x => { x => {
println!("Got shutdown indicator: {:?}", x);
for (jh, conn) in clients { for (jh, conn) in clients {
use std::net::Shutdown; use std::net::Shutdown;
eprintln!("Shutting down client...");
conn.shutdown(Shutdown::Both).expect("couldn't shutdown client"); conn.shutdown(Shutdown::Both).expect("couldn't shutdown client");
jh.join().expect("couldn't join client thread"); jh.join().expect("couldn't join client thread");
} }
eprintln!("Done shutting down everything");
return; return;
} }
} }

View file

@ -5,7 +5,7 @@ use std::mem::size_of;
use std::net::TcpStream; use std::net::TcpStream;
use std::sync::Mutex; use std::sync::Mutex;
use crate::{Result, SysCall}; use crate::Result;
lazy_static! { lazy_static! {
pub static ref XOUS_SERVER_CONNECTION: Mutex<Option<TcpStream>> = Mutex::new(None); pub static ref XOUS_SERVER_CONNECTION: Mutex<Option<TcpStream>> = Mutex::new(None);
@ -48,10 +48,10 @@ pub fn _xous_syscall_to(
ret: &mut Result, ret: &mut Result,
xsc: &mut TcpStream, xsc: &mut TcpStream,
) { ) {
print!( // print!(
"Making Syscall: {:?}", // "Making Syscall: {:?}",
SysCall::from_args(nr, a1, a2, a3, a4, a5, a6, a7).unwrap() // SysCall::from_args(nr, a1, a2, a3, a4, a5, a6, a7).unwrap()
); // );
// Send the packet to the server // Send the packet to the server
for word in &[nr, a1, a2, a3, a4, a5, a6, a7] { for word in &[nr, a1, a2, a3, a4, a5, a6, a7] {
@ -68,9 +68,9 @@ pub fn _xous_syscall_to(
} }
*ret = Result::from_args(pkt); *ret = Result::from_args(pkt);
println!(" Response: {:?}", *ret); // println!(" Response: {:?}", *ret);
if Result::BlockedProcess == *ret { if Result::BlockedProcess == *ret {
println!(" Waiting again"); // println!(" Waiting again");
} else { } else {
return; return;
} }