From: Andre Noll Date: Sun, 5 Sep 2021 19:36:55 +0000 (+0200) Subject: afs: Improve error diagnostics if no admissible files are found. X-Git-Tag: v0.6.4~9 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=74e2cecb75f8cc2559410848da118b42ab1db831 afs: Improve error diagnostics if no admissible files are found. 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 --- diff --git a/afs.c b/afs.c index c4de2e8f..050e1965 100644 --- 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 4b1bfc78..9969a150 100644 --- 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; }