fix(remote): map a cut-off answer to a recoverable error and stop trusting an empty optional answer

This commit is contained in:
imSp4rky
2026-11-28 21:03:54 -07:00
parent 74fa29b6f1
commit f5c8858e6e
12 changed files with 279 additions and 76 deletions
+13 -9
View File
@@ -727,14 +727,14 @@ the error codes and the request and reply shapes that it shares with the server
closes its remote session, so the drain can end and the refreshed cache comes back.
It waits until `/api/health` reports the restarted server without `draining`,
opens a new remote session, and continues with the next title.
- A lost remote session (`SESSION_NOT_FOUND`, a connection error, a timeout, a closed
tunnel or a gateway error page): the client waits for `/api/health`, then checks the
old remote session. A live remote session takes the call again only after a connection
error, because a timed-out call can already have run. A lost one is replaced: the
- A lost remote session (`SESSION_NOT_FOUND`, a connection error, an answer cut off
after its headers, a timeout, a closed tunnel or a gateway error page): the client waits
for `/api/health`, then checks the old remote session. A live remote session takes the
call again only after a connection error, because a timed-out call can already have run.
A cut-off answer counts as a connection error, so the server can run that call twice. A lost one is replaced: the
client opens a new remote session, sends `titles` and the current title's `tracks`
again, and then sends the failed call again. A title or track that the new remote
session gives another ID keeps its old ID on the client, and the client sends the
new ID. The client matches a title by season and episode number, and a track by its
again, and then sends the failed call again. A title or track that the new remote session
gives another ID keeps its old ID on the client, and the client sends the new ID. The client matches a title by season and episode number, and a track by its
attributes.
The client waits up to 30 minutes for the server, which covers a deploy's drain. It
@@ -742,8 +742,12 @@ the error codes and the request and reply shapes that it shares with the server
for example after a change to the API key's `server_cdm` grant. An interactive login
asks for its input again.
- **Server resolution.** `resolve_server()` reads `config.remote_services.<name>`
into `{url, api_key, services, server_cdm}`, injecting the `server_cdm` flag into
the services map as `_server_cdm`.
into `{url, api_key, services, server_cdm}`. It puts the `server_cdm` flag into a
copy of the services map as `_server_cdm`, and never changes the loaded config.
- **Optional routes.** A call to a route that an older server can lack (the segment filter,
bad content key reports, the log poll) counts as empty only when the server answers 404
with no `error_code`. Any other error stops the call: a segment filter that fails on the
server stops the track download, and the client never keeps every segment in its place.
---