Repeater, room server, sensor: guests no longer cause a flash write per request

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-11-18 12:57:53 +01:00
1 parent 84f6fa03b2
commit de92ca9ba2
5 files changed
+26 -13

No files matched your search

@@ -109,17 +109,28 @@ TEST(AclReplayFloor, FloorsOutliveAclClear) {
EXPECT_FALSE(n.accept(n.acl->putClient(idFor(3), 0), NOW - 50));
}
TEST(AclReplayFloor, EvictedClientKeepsItsFloor) {
TEST(AclReplayFloor, GuestTrafficWritesNothing) {
Node n;
ClientInfo* g = n.acl->putClient(idFor(4), 0);
g->last_activity = 1; // least active -> evicted first
ASSERT_TRUE(n.accept(g, NOW - 70));
for (int i = 0; i < MAX_CLIENTS; i++) {
g->permissions = PERM_ACL_GUEST; // anybody, with the default empty guest password
int writes = n.fs.writes;
for (uint32_t i = 0; i < 1000; i++) ASSERT_TRUE(n.accept(g, NOW - 1000 + i));
EXPECT_EQ(n.fs.writes, writes);
}
TEST(AclReplayFloor, GuestsDoNotPushOutAdminFloors) {
Node n;
ASSERT_TRUE(n.accept(n.admin(3), NOW - 50));
n.acl->save(&n.fs);
n.acl->clear(); // the admin's floor is an orphan now
for (int i = 0; i < 4 * MAX_CLIENTS; i++) { // a flood of fresh guest identities
ClientInfo* c = n.acl->putClient(idFor(100 + i), 0);
c->last_activity = 1000 + i;
c->permissions = PERM_ACL_GUEST;
c->last_activity = i;
n.accept(c, NOW - 10);
}
ASSERT_EQ(n.acl->getClient(idFor(4).pub_key, PUB_KEY_SIZE), nullptr);
EXPECT_FALSE(n.accept(n.acl->putClient(idFor(4), 0), NOW - 70));
n.boot();
EXPECT_FALSE(n.accept(n.acl->putClient(idFor(3), 0), NOW - 50));
}
TEST(AclReplayFloor, TornWriteFallsBackToTheOtherSlot) {