@onekeyfe/react-native-range-downloader 6.7.0-alpha.313 → 6.7.0-alpha.314
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -278,7 +278,7 @@ class ConcurrentRangeDownloader(
|
|
|
278
278
|
.firstOrNull { segFile(it.index).length() != it.length }
|
|
279
279
|
if (incomplete != null) {
|
|
280
280
|
// Keep the segment files for the next attempt to resume.
|
|
281
|
-
throw
|
|
281
|
+
throw ProtocolException("Concurrent download incomplete (segment ${incomplete.index})")
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
// All segments complete → assemble the `.partial`.
|
|
@@ -497,17 +497,17 @@ class ConcurrentRangeDownloaderOcdsTest {
|
|
|
497
497
|
val partial = partialPath()
|
|
498
498
|
// First invocation: the short body leaves segment 6 one byte short, so this
|
|
499
499
|
// call throws "incomplete" and keeps the `.segN` for resume.
|
|
500
|
-
|
|
501
|
-
|
|
500
|
+
val handle = ConcurrentRangeDownloader.CancelHandle()
|
|
501
|
+
val firstFailure = runCatching {
|
|
502
502
|
newDownloader().download(
|
|
503
503
|
url = url(),
|
|
504
504
|
partialFilePath = partial,
|
|
505
|
+
cancelHandle = handle,
|
|
505
506
|
onProgress = { _, _ -> },
|
|
506
507
|
)
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
assertTrue("short body must leave the first invocation incomplete", firstThrew)
|
|
508
|
+
}.exceptionOrNull()
|
|
509
|
+
assertTrue("short body must preserve a typed network failure", firstFailure is java.net.ProtocolException)
|
|
510
|
+
assertFalse("internal short body must not mark explicit cancellation", handle.aborted.get())
|
|
511
511
|
// The short segment is kept on disk, one byte under its planned length.
|
|
512
512
|
val seg = segFile(partial, target.index)
|
|
513
513
|
assertTrue("short `.segN` must be kept for resume", seg.exists())
|
package/package.json
CHANGED