diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2013-05-06 17:27:27 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2013-05-13 19:21:58 +0200 |
commit | bf6191b00825c4631312cf2446fd7b181abb7e1f (patch) | |
tree | 7bc8362eab926f8cd16a9398fb39efc3f31dbfa4 /src/main.c | |
parent | ea4324bbb6d3388c39f80906c85501feee3cb541 (diff) | |
download | pianobar-bf6191b00825c4631312cf2446fd7b181abb7e1f.tar.gz pianobar-bf6191b00825c4631312cf2446fd7b181abb7e1f.tar.bz2 pianobar-bf6191b00825c4631312cf2446fd7b181abb7e1f.zip |
Permit multiple HTTP errors in a row
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
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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; } |