slskd: search timeout sent in milliseconds, and finished files are found by name in a shared folder #274

Open
opened 2026-09-27 01:58:35 +00:00 by yonlu · 1 comment
Owner

Two defects, both found by reading slskd's source (0.26.0) against provider_slskd.go, since #267 was never run against a live daemon.

1. searchTimeout is in seconds

SearchRequest.SearchTimeout is documented as "in seconds … from the time of the last response" (default 15, minimum 5). searchRequest sends timeout.Milliseconds(), i.e. 18000, so slskd is told a search may idle for five hours. It is bounded in practice by our own poll deadline and the DELETE /searches/{id} afterwards, so the visible effect is that a search never completes on its own and always runs to our full wait.

2. collect finds files by name in a directory other grabs share

slskd moves a finished file to <downloads>/<Destination.Subdirectory>/, where the subdirectory defaults to ${SOURCE_DIRECTORY} (the remote leaf folder), and when the file already exists the default Destination.Exists = rename writes name_<ticks>.ext instead. collect looks for <downloads>/<leaf>/<name>. So:

  • a file left by an earlier failed attempt, or by the user's own download of the same folder, is collected in place of the file this grab just received (which was renamed);
  • a user who changed Destination.Subdirectory gets nothing collected at all;
  • #272's per-folder lock serialises same-named folders but cannot fix either of the above.

Direction

slskd 0.26.0 added POST /api/v0/transfers/downloads/batches, whose options.destination overrides the subdirectory pattern for that batch. Enqueue each grab as a batch with a destination unique to the grab, and collect from exactly there. On a daemon without the endpoint (404), fall back to the per-user enqueue, and in collect prefer the renamed name_<ticks>.ext written after the grab started over a pre-existing name.ext.

Add an opt-in live test (env-gated) that runs a real search and a small grab against a configured daemon, so the next API assumption is checked rather than read.

Two defects, both found by reading slskd's source (0.26.0) against `provider_slskd.go`, since #267 was never run against a live daemon. ## 1. `searchTimeout` is in seconds `SearchRequest.SearchTimeout` is documented as "in seconds … from the time of the last response" (default 15, minimum 5). `searchRequest` sends `timeout.Milliseconds()`, i.e. 18000, so slskd is told a search may idle for five hours. It is bounded in practice by our own poll deadline and the `DELETE /searches/{id}` afterwards, so the visible effect is that a search never completes on its own and always runs to our full wait. ## 2. `collect` finds files by name in a directory other grabs share slskd moves a finished file to `<downloads>/<Destination.Subdirectory>/`, where the subdirectory defaults to `${SOURCE_DIRECTORY}` (the remote leaf folder), and when the file already exists the default `Destination.Exists = rename` writes `name_<ticks>.ext` instead. `collect` looks for `<downloads>/<leaf>/<name>`. So: - a file left by an earlier failed attempt, or by the user's own download of the same folder, is collected in place of the file this grab just received (which was renamed); - a user who changed `Destination.Subdirectory` gets nothing collected at all; - #272's per-folder lock serialises same-named folders but cannot fix either of the above. ## Direction slskd 0.26.0 added `POST /api/v0/transfers/downloads/batches`, whose `options.destination` overrides the subdirectory pattern for that batch. Enqueue each grab as a batch with a destination unique to the grab, and collect from exactly there. On a daemon without the endpoint (404), fall back to the per-user enqueue, and in `collect` prefer the renamed `name_<ticks>.ext` written after the grab started over a pre-existing `name.ext`. Add an opt-in live test (env-gated) that runs a real search and a small grab against a configured daemon, so the next API assumption is checked rather than read.
yonlu self-assigned this 2026-09-27 01:58:52 +00:00
yonlu added the
Status
In Progress
label 2026-09-27 01:58:53 +00:00
Author
Owner

Batch branch batch/274-276-slskd with #274-#276, one PR. See the issue body for the approach.

Batch branch batch/274-276-slskd with #274-#276, one PR. See the issue body for the approach.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: yonlu/yellowjacket#274