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

View file

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