summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-08-03 14:24:13 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-08-03 14:24:13 -0700
commit595d5e8b54dde06d7f624d4e64458a2648477669 (patch)
tree1012272e22a318dd3c5492bb3222eea64894e2bf /src
parent26d196b00e4e692dbd9cede9ad1826ab9f2a6271 (diff)
modules/rkt: don't disconnect on -EINVAL from finalize
It's relatively acceptable to use this hammer for the other errors like ENOMEM especially when this isn't some enterprise-y service that must endure overload conditions gracefully. But the setup_finalize() step is rather likely to find invalid settings, especially now that til_setting_t.nocheck with the ':' prefix is a thing. This commit doesn't try resume the setup at the invalid setting (yet, that will require further til_module_t.setup() method work), but it at least doesn't rudely disconnect. The user just gets dumped back to the SCENES state main prompt.
Diffstat (limited to 'src')
-rw-r--r--src/modules/rkt/rkt_scener.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/modules/rkt/rkt_scener.c b/src/modules/rkt/rkt_scener.c
index 5e90eed..25650c8 100644
--- a/src/modules/rkt/rkt_scener.c
+++ b/src/modules/rkt/rkt_scener.c
@@ -1179,8 +1179,19 @@ int rkt_scener_update(rkt_context_t *ctxt)
return rkt_scener_err_close(scener, EINVAL); /* this really shouldn't happen */
r = til_module_setup_finalize(module, scener->new_scene.settings, &setup);
- if (r < 0) /* FIXME TODO we should probably un-add the scene from scenes_settings??? */
- return rkt_scener_err_close(scener, r);
+ if (r < 0) { /* FIXME TODO we should probably un-add the scene from scenes_settings??? */
+ if (r != -EINVAL)
+ return rkt_scener_err_close(scener, r);
+
+ /* FIXME TODO: error recovery needs a bunch of work, but let's not just
+ * hard disconnect when finalize finds invalid settings... especially
+ * with the addition of til_setting_t.nocheck / ':" prefixing, this is
+ * much more likely.
+ */
+ scener->new_scene.settings = NULL;
+
+ return rkt_scener_send_error(scener, EINVAL, RKT_SCENER_FSM_SEND_SCENES);
+ }
/* have baked setup @ setup, create context using it */
r = til_module_create_context(module,
© All Rights Reserved