]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
afs: Improve error diagnostics if no admissible files are found.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 5 Sep 2021 19:36:55 +0000 (21:36 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 29 Sep 2021 17:04:43 +0000 (19:04 +0200)
Currently, the server prints something like the following with
loglevel error:

Sep 05 21:19:42 (4) (31845) open_next_audio_file: key not found in rbtree
Sep 05 21:19:42 (4) (31844) recv_afs_result: afs code: 1, expected: 0
Sep 05 21:19:42 (4) (31844) recv_afs_result: did not receive open fd from afs

This is both cryptic and scary, given that this error is handled by
simply clearing the play bit from the vss status flags.

This commit changes the code to only print one clear log message with
loglevel notice:

Sep 05 21:34:45 (3) (5233) log_statistics: no admissible files

afs.c
vss.c

diff --git a/afs.c b/afs.c
index c4de2e8f37d5a94937f0fe3519715d40242f5329..050e1965cb68e71257c109d35b6ae23671c56949 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -424,7 +424,8 @@ static int open_next_audio_file(void)
 
        ret = open_and_update_audio_file(&afd);
        if (ret < 0) {
-               PARA_ERROR_LOG("%s\n", para_strerror(-ret));
+               if (ret != -OSL_ERRNO_TO_PARA_ERROR(E_OSL_RB_KEY_NOT_FOUND))
+                       PARA_ERROR_LOG("%s\n", para_strerror(-ret));
                goto no_admissible_files;
        }
        shmid = ret;
diff --git a/vss.c b/vss.c
index 4b1bfc78986321d1df9335517dd00a87cda0dd87..9969a150ee63291e182f058664af9178eabf77f3 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -965,6 +965,11 @@ static void recv_afs_result(struct vss_task *vsst, fd_set *rfds)
        if (ret < 0)
                goto err;
        vsst->afsss = AFS_SOCKET_READY;
+       if (afs_code == NO_ADMISSIBLE_FILES) {
+               PARA_NOTICE_LOG("no admissible files\n");
+               ret = 0;
+               goto err;
+       }
        ret = -E_NOFD;
        if (afs_code != NEXT_AUDIO_FILE) {
                PARA_ERROR_LOG("afs code: %u, expected: %d\n", afs_code,
@@ -1004,7 +1009,8 @@ err:
        mmd->afd.afhi.chunk_table = NULL;
        if (passed_fd >= 0)
                close(passed_fd);
-       PARA_ERROR_LOG("%s\n", para_strerror(-ret));
+       if (ret < 0)
+               PARA_ERROR_LOG("%s\n", para_strerror(-ret));
        mmd->new_vss_status_flags = VSS_NEXT;
 }