diff options
Diffstat (limited to 'packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/photos')
| -rw-r--r-- | packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/photos/PhotoChannels.kt | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/photos/PhotoChannels.kt b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/photos/PhotoChannels.kt index 2e7c519..c1de859 100644 --- a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/photos/PhotoChannels.kt +++ b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/photos/PhotoChannels.kt @@ -135,9 +135,11 @@ class PhotoChannels( if (destinations.get() == null) throw Refused("Refused: no destination") val next = SyncConfig.fromJson(o, System.currentTimeMillis(), previous) val edit = prefs.edit().putString(CONFIG, next.toJson().toString()) - // A different scope is a different backup: due at once, and whatever - // the last one was refused for is not this one's problem. - if (previous == null || previous.since != next.since) { + // Anything that asks for more (another scope, an album, the videos) + // is due at once rather than tomorrow: the person just asked for it, + // and waits to see it go. Whatever the last run was refused for is + // not this one's problem. + if (previous == null || previous != next) { edit.remove(LAST).remove(FAILURE).remove(FAILURE_AT).remove(NOTIFIED) } edit.apply() @@ -367,7 +369,7 @@ class PhotoChannels( .setContentIntent(pending).setAutoCancel(true).build()) } - /** `range` of `stream`, `size` bytes long, as a 206 (or a 416 for a range that cannot be served). */ + /** `range` of `stream`, `size` bytes long (or a 416 for a range that cannot be served). */ fun serveRange(stream: InputStream, size: Long, mime: String, range: String?): WebResourceResponse { val r = ByteRange.parse(range, size) ?: run { stream.close() @@ -377,7 +379,9 @@ class PhotoChannels( val headers = mapOf("Cache-Control" to "no-store", "X-Content-Type-Options" to "nosniff", "Content-Range" to "bytes ${r.first}-${r.last}/$size", "Content-Length" to (r.last - r.first + 1).toString()) - return WebResourceResponse(mime, null, 206, "Partial Content", headers, ByteRange.slice(stream, r)) + // 200, not 206: what was asked is in the address, and a 206 to a + // request that carried no Range is not something to rely on. + return WebResourceResponse(mime, null, 200, "OK", headers, ByteRange.slice(stream, r)) } fun digestOf(s: InputStream): ByteArray { |