Generate auth check unconditionally in read_message

If all messages required auth (both no_conn_ids and conn_only_ids
empty), the auth check block would be skipped entirely. Now generates
a simple check_authenticated_() call as fallback when there are no
exceptions to the default auth requirement.
This commit is contained in:
J. Nick Koston
2026-02-08 10:23:22 -06:00
parent 2376c020e8
commit 491112db69
+5 -1
View File
@@ -2930,8 +2930,8 @@ static const char *const TAG = "api.service";
out = f"void {class_name}::read_message(uint32_t msg_size, uint32_t msg_type, const uint8_t *msg_data) {{\n"
# Auth check block before dispatch switch
out += " // Check authentication/connection requirements\n"
if no_conn_ids or conn_only_ids:
out += " // Check authentication/connection requirements\n"
out += " switch (msg_type) {\n"
if no_conn_ids:
@@ -2951,6 +2951,10 @@ static const char *const TAG = "api.service";
out += " }\n"
out += " break;\n"
out += " }\n"
else:
out += " if (!this->check_authenticated_()) {\n"
out += " return;\n"
out += " }\n"
# Dispatch switch
out += " switch (msg_type) {\n"