examples: ensure at least 3 sockets to avoid running out (DHCP, DNS, the user's)

This commit is contained in:
Dario Nieuwenhuis
2024-08-05 21:38:30 +02:00
parent 21edbd3c17
commit 59cb1531c9
27 changed files with 46 additions and 128 deletions

View File

@@ -89,13 +89,8 @@ async fn main(spawner: Spawner) -> ! {
// Init network stack
static STACK: StaticCell<Stack<Device>> = StaticCell::new();
static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new();
let stack = &*STACK.init(Stack::new(
device,
config,
RESOURCES.init(StackResources::<2>::new()),
seed,
));
static RESOURCES: StaticCell<StackResources<3>> = StaticCell::new();
let stack = &*STACK.init(Stack::new(device, config, RESOURCES.init(StackResources::new()), seed));
// Launch network task
unwrap!(spawner.spawn(net_task(stack)));

View File

@@ -93,13 +93,8 @@ async fn main(spawner: Spawner) -> ! {
//});
static STACK: StaticCell<Stack<Device>> = StaticCell::new();
static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new();
let stack = &*STACK.init(Stack::new(
device,
config,
RESOURCES.init(StackResources::<2>::new()),
seed,
));
static RESOURCES: StaticCell<StackResources<3>> = StaticCell::new();
let stack = &*STACK.init(Stack::new(device, config, RESOURCES.init(StackResources::new()), seed));
// Launch network task
unwrap!(spawner.spawn(net_task(stack)));

View File

@@ -145,13 +145,8 @@ async fn main(spawner: Spawner) {
// Init network stack
static STACK: StaticCell<Stack<Device<'static, MTU>>> = StaticCell::new();
static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new();
let stack = &*STACK.init(Stack::new(
device,
config,
RESOURCES.init(StackResources::<2>::new()),
seed,
));
static RESOURCES: StaticCell<StackResources<3>> = StaticCell::new();
let stack = &*STACK.init(Stack::new(device, config, RESOURCES.init(StackResources::new()), seed));
unwrap!(spawner.spawn(net_task(stack)));