Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a1d5240 authored by Andreas Huber's avatar Andreas Huber Committed by Android (Google) Code Review
Browse files

Merge "Fix retries when server doesn't support range requests." into jb-mr1-dev

parents eccfd929 a7607a7f
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -298,7 +298,9 @@ void NuCachedSource2::fetchInternal() {

        Mutex::Autolock autoLock(mLock);

        if (err == ERROR_UNSUPPORTED) {
        if (err == ERROR_UNSUPPORTED || err == -EPIPE) {
            // These are errors that are not likely to go away even if we
            // retry, i.e. the server doesn't support range requests or similar.
            mNumRetriesLeft = 0;
            return;
        } else if (err != OK) {
@@ -317,8 +319,14 @@ void NuCachedSource2::fetchInternal() {
    Mutex::Autolock autoLock(mLock);

    if (n < 0) {
        ALOGE("source returned error %ld, %d retries left", n, mNumRetriesLeft);
        mFinalStatus = n;
        if (n == ERROR_UNSUPPORTED || n == -EPIPE) {
            // These are errors that are not likely to go away even if we
            // retry, i.e. the server doesn't support range requests or similar.
            mNumRetriesLeft = 0;
        }

        ALOGE("source returned error %ld, %d retries left", n, mNumRetriesLeft);
        mCache->releasePage(page);
    } else if (n == 0) {
        ALOGI("ERROR_END_OF_STREAM");