JurajSadel / esp32c3-no-std-async-mqtt-demo

Apache License 2.0
23 stars 2 forks source link

Document how to increase the smoltcp DNS max server count #6

Open SergioGasquez opened 1 year ago

SergioGasquez commented 1 year ago

In some routers, the program crashes with the following panic:

I (270) boot: Disabling RNG early entropy source...
start connection task
Device capabilities: Ok(EnumSet(Client | AccessPoint))
Starting wifi
Wifi started!
About to connect...
Wifi connected!
Waiting to get IP address...

!! A panic occured in '/home/sergio/.cargo/registry/src/index.crates.io-6f17d22bba15001f/smoltcp-0.10.0/src/socket/dns.rs', at line 170, column 49

PanicInfo {
    payload: Any { .. },
    message: Some(
        called `Result::unwrap()` on an `Err` value: (),
    ),
    location: Location {
        file: "/home/sergio/.cargo/registry/src/index.crates.io-6f17d22bba15001f/smoltcp-0.10.0/src/socket/dns.rs",
        line: 170,
        col: 49,
    },
    can_unwind: true,
}

The solution was proposed by @MabezDev in https://github.com/JurajSadel/esp32c3-no-std-async-mqtt-demo/pull/1#issue-1813747945:

For my router I also needed to bump the number of DNS servers smoltcp has capacity for with:

# .cargo/config.toml
[env]
SMOLTCP_DNS_MAX_SERVER_COUNT = "3"

Be warned that you have to do a clean build for those changes to take effect, see: https://github.com/rust-lang/cargo/issues/10358