advert_loop

Function advert_loop 

Source
pub async fn advert_loop<CS: CounterStore + 'static>(mac: DeviceNodeHandle<CS>)
Expand description

Emits the device’s unsolicited announcements: one beacon at bring-up under PROP_STARTUP_BEACON, then whatever PROP_ADVERT_INTERVAL and PROP_BEACON_INTERVAL ask for.

The two intervals run independently rather than sharing a period. They announce different things at very different costs — a beacon is a path, an advertisement is a signed identity — so a mesh normally wants the cheap one far more often than the expensive one, and one knob could not express that.

Every period is scattered by up to [ANNOUNCE_JITTER_SHIFT] of the interval. Two nodes configured alike and switched on together would otherwise stay in step indefinitely, colliding on the air every period and — worse — colliding again on each retry, since a shared schedule makes them contend from the same starting instant every time. CAD and backoff settle the individual collision; the scatter is what keeps the mesh from having to.

The startup beacon itself is not delayed. Devices do not power on in unison, so bring-up is already dispersed by whatever staggered them, and a node that has just come up is the one whose neighbours most need to hear from it.