audiod: Fix error message on status errors.
authorAndre Noll <maan@systemlinux.org>
Sat, 20 Jul 2013 10:28:18 +0000 (12:28 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 22 Sep 2013 00:29:18 +0000 (02:29 +0200)
If para_audiod can not parse a status item received from para_server,
it currently prints

task_notify: notifying task client: audiod switched off
btr_remove_node: removing btr node client from buffer tree
unregister_task: unregistering client (audiod switched off)

This is misleading at best. The error message for status timeouts has
the same problem. This patch makes para_audiod print meaningful error
messages in both cases.

audiod.c
error.h

index 611e72d..64925b7 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -1223,14 +1223,14 @@ static int status_post_select(struct sched *s, struct task *t)
                        struct timeval diff;
                        tv_diff(now, &st->last_status_read, &diff);
                        if (diff.tv_sec > 61)
-                               task_notify(&st->ct->task, E_AUDIOD_OFF);
+                               task_notify(&st->ct->task, E_STATUS_TIMEOUT);
                        goto out;
                }
                btr_merge(st->btrn, st->min_iqs);
                sz = btr_next_buffer(st->btrn, &buf);
                ret = for_each_stat_item(buf, sz, update_item);
                if (ret < 0) {
-                       task_notify(&st->ct->task, E_AUDIOD_OFF);
+                       task_notify(&st->ct->task, -ret);
                        goto out;
                }
                if (sz != ret) {
diff --git a/error.h b/error.h
index b0133de..82df5ca 100644 (file)
--- a/error.h
+++ b/error.h
@@ -338,6 +338,7 @@ extern const char **para_errlist[];
        PARA_ERROR(UNSUPPORTED_AUDIO_FORMAT, "given audio format not supported"), \
        PARA_ERROR(NOT_PLAYING, "not playing"), \
        PARA_ERROR(AUDIOD_OFF, "audiod switched off"), \
+       PARA_ERROR(STATUS_TIMEOUT, "status item timeout"), \
 
 
 #define AUDIOD_COMMAND_ERRORS \