Skip to content

Commit 452dd83

Browse files
author
opencode
committed
access-controller: bump WIEGAND_CHANNEL to 16 (C6)
Capacity-4 channel could silently drop swipes whenever access_task backpressured on a held lock. Audited http.rs: status page, /config GET, /fobs GET, and /fobs (add|delete) POST all already snapshot under their guards and drop before socket I/O; /ota upload doesn't touch those mutexes. So channel depth was the remaining gap. Bumped to 16, which absorbs a worst-case burst (a slow-but-eventually- returning HTTP handler that briefly holds a mutex) without losing physical swipes.
1 parent 1909322 commit 452dd83

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

access-controller/src/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,13 @@ pub struct RuntimeConfig {
7676
static CONFIG: StaticCell<RuntimeConfig> = StaticCell::new();
7777

7878
// Channel for Wiegand reads -> access control task
79-
static WIEGAND_CHANNEL: Channel<CriticalSectionRawMutex, WiegandRead, 4> = Channel::new();
79+
// Bounded queue from the (interrupt-driven) Wiegand decoder to the
80+
// access_task. Capacity 4 was tight: any handler in http.rs that holds
81+
// fobs/local_fobs/settings/last_swipe across socket I/O (notably the
82+
// OTA upload) backpressures access_task; once 4 swipes queue up, the
83+
// 5th is dropped with only a warn. Bumped to 16 so a slow HTTP client
84+
// can't silently mask door swipes.
85+
static WIEGAND_CHANNEL: Channel<CriticalSectionRawMutex, WiegandRead, 16> = Channel::new();
8086

8187
// Event buffer with peek/commit semantics for reliable delivery
8288
pub static EVENT_BUFFER: EventBuffer = EventBuffer::new();

0 commit comments

Comments
 (0)