Handle saved-setting apply errors and document committed CLI interaction results
This commit is contained in:
1 parent
d741eb7374
commit
1b0034e1ba
2 files changed
+7
No files matched your search
@@ -12,6 +12,9 @@ TCP JSON-RPC клиент для управления чатом uTun без GUI
|
||||
--------
|
||||
JSON line: запрос {"id":N,"cmd":"...","params"} → ответ {"id":N,"ok":true,"data":...}
|
||||
При подписке (subscribe) сервер шлёт асинхронные события: {"event":"...",...}
|
||||
Успешные poll/vote/react обычно возвращают снимок. Если изменение уже сохранено,
|
||||
но чтение снимка отказало,data содержит ch,message_id,committed:true,snapshot_pending:true.
|
||||
В этом случае повторяют только feedback <ch_id> <message_id>:повтор poll/react меняет состояние ещё раз.
|
||||
|
||||
Переменные окружения
|
||||
--------------------
|
||||
|
||||
@@ -343,6 +343,10 @@ static int handle_chat_setting(int fd, int id, const char* json) {
|
||||
int rc = chat_setting_set(inst, name, value);
|
||||
if (rc == -1) { send_response(fd, id, NULL, "unknown setting"); return 0; }
|
||||
if (rc == -2) { send_response(fd, id, NULL, "invalid value"); return 0; }
|
||||
if (rc < 0) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CONTROL, "headless setting saved but runtime apply failed name=%s rc=%d", name, rc);
|
||||
send_response(fd, id, NULL, "setting saved but runtime apply failed; retry setting"); return 0;
|
||||
}
|
||||
printf("control: chat_setting %s=%s\n", name, value);
|
||||
send_response(fd, id, "{\"set\":true}", NULL);
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user