From bf6191b00825c4631312cf2446fd7b181abb7e1f Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Mon, 6 May 2013 17:27:27 +0200 Subject: Permit multiple HTTP errors in a row MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1) Make sure that multiple bad playlists in a row don’t result in a temporary ban 2) Ignore songs skipped because the playlist timed out after pausing for too long --- src/main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index b16eb97..c8bf5c6 100644 --- a/src/main.c +++ b/src/main.c @@ -300,8 +300,15 @@ static void BarMainPlayerCleanup (BarApp_t *app, pthread_t *playerThread) { pthread_cond_destroy (&app->player.pauseCond); pthread_mutex_destroy (&app->player.pauseMutex); - /* don't continue playback if thread reports error */ - if (threadRet != (void *) PLAYER_RET_OK) { + if (threadRet == (void *) PLAYER_RET_OK) { + app->playerErrors = 0; + } else if (threadRet == (void *) PLAYER_RET_SOFTFAIL) { + ++app->playerErrors; + if (app->playerErrors >= app->settings.maxPlayerErrors) { + /* don't continue playback if thread reports too many error */ + app->curStation = NULL; + } + } else { app->curStation = NULL; } -- cgit v1.2.3