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

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

Merge "When http streaming and Content-Length is unknown, make sure to return...

Merge "When http streaming and Content-Length is unknown, make sure to return all" into honeycomb-mr1
parents 89c120e7 9dc01934
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -410,9 +410,16 @@ ssize_t NuHTTPDataSource::readAt(off64_t offset, void *data, size_t size) {
            internalRead((uint8_t *)data + numBytesRead, size - numBytesRead);

        if (n < 0) {
            if (numBytesRead == 0 || mContentLengthValid) {
                return n;
            }

            // If there was an error we want to at least return the data
            // we've already successfully read. The next call to read will
            // then return the error.
            n = 0;
        }

        int64_t delayUs = ALooper::GetNowUs() - startTimeUs;
        addBandwidthMeasurement_l(n, delayUs);