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

Commit a038c14e authored by Dave Burke's avatar Dave Burke Committed by Android (Google) Code Review
Browse files

Merge "Don't hold onto the lock while reconnecting to the server" into ics-mr0

parents 0cc79c66 95c4d603
Loading
Loading
Loading
Loading
+18 −10
Original line number Diff line number Diff line
@@ -279,6 +279,8 @@ void NuCachedSource2::onMessageReceived(const sp<AMessage> &msg) {
void NuCachedSource2::fetchInternal() {
    LOGV("fetchInternal");

    bool reconnect = false;

    {
        Mutex::Autolock autoLock(mLock);
        CHECK(mFinalStatus == OK || mNumRetriesLeft > 0);
@@ -286,9 +288,16 @@ void NuCachedSource2::fetchInternal() {
        if (mFinalStatus != OK) {
            --mNumRetriesLeft;

            reconnect = true;
        }
    }

    if (reconnect) {
        status_t err =
            mSource->reconnectAtOffset(mCacheOffset + mCache->totalSize());

        Mutex::Autolock autoLock(mLock);

        if (err == ERROR_UNSUPPORTED) {
            mNumRetriesLeft = 0;
            return;
@@ -299,7 +308,6 @@ void NuCachedSource2::fetchInternal() {
            return;
        }
    }
    }

    PageCache::Page *page = mCache->acquirePage();