Optimize tcp_simple endpoint integration

This commit is contained in:
Michael Mikovsky
2026-06-01 15:54:17 -06:00
parent 9ab130a620
commit 641ee7682a
14 changed files with 43 additions and 18 deletions
+1
View File
@@ -10,6 +10,7 @@ include.workspace = true
[dependencies]
unshell = { workspace = true }
leaf-shell = { path = "../../unshell-leaves/leaf-shell" }
tcp_simple = { path = "../../unshell-leaves/tcp_simple" }
[[bin]]
name = "endpoint_test"
+9 -1
View File
@@ -1,19 +1,27 @@
#![no_std]
#![no_main]
extern crate alloc;
use core::net::Ipv4Addr;
use leaf_shell::{ShellLeaf, ShellState};
use tcp_simple::TCPServerLeaf;
use unshell::protocol::{Endpoint, Leaf};
const ID: u32 = 0x12345678;
const CHILD_ID: u32 = 0x87654321;
#[unsafe(no_mangle)]
pub fn main(_argc: i32, _argv: *const *const u8) {
let mut endpoint = Endpoint::new(ID);
endpoint.path.push(ID);
let mut shell = ShellLeaf::new(ShellState::new());
let mut tcp = TCPServerLeaf::bind_ipv4(Ipv4Addr::LOCALHOST, 1337, CHILD_ID).unwrap();
loop {
// One transport tick keeps the minimized binary smaller. Packets read from TCP
// are processed by the shell on the next loop, then flushed by this same tick.
shell.update(&mut endpoint);
tcp.update(&mut endpoint);
}
}