Move control messages logging

Log a control message when they are sent, not when they are pushed to
the message queue.
This commit is contained in:
Romain Vimont 2026-04-07 20:35:42 +02:00
parent ccfd3269d4
commit 4b2cb2da57

View file

@ -92,10 +92,6 @@ sc_controller_destroy(struct sc_controller *controller) {
bool
sc_controller_push_msg(struct sc_controller *controller,
const struct sc_control_msg *msg) {
if (sc_get_log_level() <= SC_LOG_LEVEL_VERBOSE) {
sc_control_msg_log(msg);
}
bool pushed = false;
sc_mutex_lock(&controller->mutex);
@ -166,6 +162,10 @@ run_controller(void *data) {
struct sc_control_msg msg = sc_vecdeque_pop(&controller->queue);
sc_mutex_unlock(&controller->mutex);
if (sc_get_log_level() <= SC_LOG_LEVEL_VERBOSE) {
sc_control_msg_log(&msg);
}
bool eos;
bool ok = process_msg(controller, &msg, &eos);
sc_control_msg_destroy(&msg);