mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-20 09:03:28 +00:00
fix buffer length check computation
This commit is contained in:
parent
413b7153ac
commit
71e41d4b0a
1 changed files with 2 additions and 2 deletions
|
|
@ -103,7 +103,7 @@ impl<'a> ShellCmdApi<'a> for NetCmd {
|
||||||
match stream.read(&mut buf) {
|
match stream.read(&mut buf) {
|
||||||
Ok(len) => {
|
Ok(len) => {
|
||||||
log::trace!("raw response ({}): {:?}", len, &buf[..len]);
|
log::trace!("raw response ({}): {:?}", len, &buf[..len]);
|
||||||
write!(ret, "{}", std::string::String::from_utf8_lossy(&buf[..len])).ok(); // let it run off the end
|
write!(ret, "{}", std::string::String::from_utf8_lossy(&buf[..len.min(buf.len())])).ok(); // let it run off the end
|
||||||
}
|
}
|
||||||
Err(e) => write!(ret, "Didn't get response from host: {:?}", e).unwrap(),
|
Err(e) => write!(ret, "Didn't get response from host: {:?}", e).unwrap(),
|
||||||
}
|
}
|
||||||
|
|
@ -123,7 +123,7 @@ impl<'a> ShellCmdApi<'a> for NetCmd {
|
||||||
let boot_instant = env.boot_instant.clone();
|
let boot_instant = env.boot_instant.clone();
|
||||||
move || {
|
move || {
|
||||||
let listener = TcpListener::bind("0.0.0.0:80").unwrap();
|
let listener = TcpListener::bind("0.0.0.0:80").unwrap();
|
||||||
// limit to 2 because we're a bit shy on space in shellchat right now; there is a 32-thread limit per process, and shellchat has the kitchen sink.
|
// limit to 4 because we're a bit shy on space in shellchat right now; there is a 32-thread limit per process, and shellchat has the kitchen sink.
|
||||||
let pool = ThreadPool::new(4);
|
let pool = ThreadPool::new(4);
|
||||||
|
|
||||||
for stream in listener.incoming() {
|
for stream in listener.incoming() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue