Commit Graph
567 Commits
Author SHA1 Message Date
Michel de Graaf 60f7100e30 feat(daemon): publish room member statistics over RPC and the CLI
The statistics parsed from the JoinRoom reply were reachable only from the
library. They answer the question `room users` already exists to ask -- who
is in here, and are they worth downloading from -- so they belong on its
output rather than behind a second call.

- proto: room.member_stats, with a RoomUserStatsDto carrying status, share
  counts, free slots and country
- SessionApi::room_member_stats, so local and remote sessions stay
  interchangeable; the status word is decoded through one shared helper
  rather than a third copy of the match
- `room users` now emits status, average_speed, shared_files,
  shared_folders, slots_free and country, each null when the server said
  nothing, documented in SKILL.md
- docs/openrpc.json regenerated from the wire types
2026-08-28 13:27:09 +00:00
Michel de Graaf a91d35b672 feat(daemon): expose watching over the RPC surface and the CLI
The watch subscription was reachable only from the library. It is most
useful against a daemon -- that is the session that stays connected long
enough to receive the server's status pushes -- so it needs the wire.

- proto: user.watch / user.unwatch / user.watched, with a Watched response
- SessionApi gains watch_user / unwatch_user / watched_users, so a local and
  a remote session are still interchangeable above the seam
- CLI: `watch add`, `watch remove`, `watch list`, documented in SKILL.md
  including the caveat that a one-shot run's watch ends with the run
- docs/openrpc.json regenerated from the wire types
2026-08-28 13:22:50 +00:00
Michel de Graaf b505718db9 feat(lib): watch and unwatch users (WatchUser 5 / UnwatchUser 6)
Adds the server-side watch subscription a buddy list needs: WatchUser (5)
asks the server to keep pushing a user's status, UnwatchUser (6) cancels it.
The reply to a watch carries the user's current status and share statistics,
which merge into the existing per-user snapshot read via Client::user_info.

Issue #47 asked for AddUserList (141) / WatchedUserAdded (142) /
WatchedUserRemoved (143). Those codes are EnableRoomInvitations,
ChangePassword and AddRoomOperator in the Soulseek protocol -- there are no
such messages on the wire. Watching is codes 5 and 6, so that is what this
implements.

- message/server/watch_user.rs: WatchUserHandler (code 5), tolerant of an
  absent user and of a truncated frame
- MessageFactory::build_watch_user / build_unwatch_user
- Client::watch_user / unwatch_user / watched_users
- The watch reply has no privileged flag, so it preserves whatever an
  earlier GetUserStatus recorded rather than asserting false
2026-08-28 12:44:43 +00:00
Michel de Graaf fa49ebd2eb feat(lib): per-member room statistics from the JoinRoom reply
The JoinRoom (code 14) reply carries, after the membership list, four
parallel vectors describing each member: status, share statistics, free
upload slots and country. The handler stopped after the usernames, so all of
it was discarded. It is now parsed and exposed as Client::room_member_stats.

Issue #48 asked for RoomStats (57) and RoomListStats (55). Those codes are
UserInterests and MyRecommendations in the Soulseek protocol; there is no
RoomStats message on the wire. Per-room user counts already arrive with
RoomList (64), which the client handles, and the per-member statistics are
part of the JoinRoom reply -- so that is where this adds them.

- join_room.rs: parse the stat vectors, each bounded by the payload so a
  hostile count cannot hang or overallocate
- types::RoomUserStats; every field looked up positionally so a server
  sending short vectors (or omitting countries) does not shift the roster
- ServerMessage/ClientOperation::RoomMemberStats and the context snapshot
  behind Client::room_member_stats, replaced on each rejoin
2026-08-28 12:44:37 +00:00
Michel de Graaf 0f91ffdcf3 feat(tui): dismiss a finished download with d
A completed row used to ignore d: only a queued transfer could be pulled
out of the list, so a finished one sat there until the next restart. d
now goes through one handler that drops a finished row whatever the
session thinks of it — a completed transfer can live only in this window,
restored from an earlier run, where there is nothing to forget.

The finished-status test was spelled out twice in clear_finished_downloads
and had to agree by hand; both callers now share is_finished().
2026-08-27 13:22:39 +02:00
Michel de Graaf a5d44d7611 docs(website): drop soulfind server link from footer 2026-08-18 16:18:27 +02:00
Michel de Graaf 5c8d0088c5 docs(website): move project links into LINKS 2026-08-18 16:16:44 +02:00
Michel de Graaf e78cdadf69 docs(website): list Player and Staccato, fix install pill overflow on mobile 2026-08-18 16:16:44 +02:00
Michel de Graaf ca4fe378be Merge pull request #46 from michel/release-plz-2026-08-18T06-40-22Z
chore: release v14.1.2
2026-08-18 10:44:45 +02:00
Michel de Graaf 21f60df1d9 chore: release v14.1.2 2026-08-18 08:40:23 +02:00
Michel de Graaf eac340cdb8 docs: drop bot wording in favor of client 2026-08-18 08:39:04 +02:00
Michel de Graaf 7f5cff43ef Merge pull request #45 from michel/release-plz-2026-08-17T08-46-25Z
chore: release v14.1.1
2026-08-17 10:53:59 +02:00
Michel de Graaf 078ffee0e4 chore: release v14.1.1 2026-08-17 10:46:26 +02:00
Michel de Graaf 3000b4426e Merge branch 'develop': listener transfer-token and download token-race fixes 2026-08-17 10:44:09 +02:00
Michel de Graaf ee4862b7f3 Merge pull request #44 from michel/issue-42-download-token-races
fix(peer): survive download token races on the listener path
2026-08-17 10:42:53 +02:00
Michel de Graaf f9becf9680 fix(peer): survive download token races on the listener path
A P-connection drop failed every download for its user, including ones
actively transferring on their own healthy F connection:
collect_failed_tokens now only fails queued downloads. And an F
connection could look its token up before the client-operations thread
had registered it: the listener now waits for the registration, and
claims it only for the matching peer and only when not already claimed.

Fixes #42
2026-08-17 10:23:21 +02:00
Michel de Graaf 1611b4baf3 docs: list projects built on soulseek-rs-lib
Add a 'Projects using soulseek-rs-lib' section to the README and a
matching section on the website community page, starting with seakarr.
Both point new projects at issue #12 to reserve a client minor version.
2026-08-17 09:46:06 +02:00
Michel de Graaf ac06cb9a5a feat(lib): reserve client minor versions 1 (unidentified) and 2 (reference client)
Document the minor-version registry on ClientVersion: within the
soulseek-rs major (176), minor 1 stays the library default for
unidentified consumers and minor 2 is now the reference CLI/TUI client.
Downstream clients reserve their own minor via issue #12.
2026-08-17 09:46:06 +02:00
Michel de Graaf 1833717521 Merge pull request #43 from michel/issue-41-listener-token-wait
fix(peer): wait for the transfer token before the download lookup
2026-08-17 09:41:43 +02:00
Michel de Graaf 543e9ee865 fix(peer): wait for the transfer token before the download lookup
The listener looked the download up immediately after the PeerInit(F),
but the 4-byte transfer token routinely arrives in a separate TCP
segment, so every firewalled peer download failed with "Download info
missing". Wait for the token within the handshake deadline and give up
on the connection when it never arrives.

Also quiets the dispatcher's unhandled-message-code log to debug; the
server routinely sends codes the library doesn't implement.

Fixes #41
2026-08-17 09:22:03 +02:00
Michel de Graaf f6788320b7 Merge pull request #40 from michel/release-plz-2026-08-14T21-36-33Z
chore: release v14.1.0
2026-08-15 00:18:08 +02:00
Michel de Graaf 742fc21629 chore: release v14.1.0 2026-08-14 23:57:17 +02:00
Michel de Graaf 8128a4cbec style: rustfmt in chat wrap test 2026-08-14 23:55:43 +02:00
Michel de Graaf 0aa6f33572 feat(tui): wrap long chat messages instead of clipping them 2026-08-14 23:26:11 +02:00
Michel de Graaf 4232a1e223 feat(tui): navigate and confirm while filtering search results
In results filter mode, Up/Down move the selection over the filtered
list and Enter confirms the filter (keeps the query, returns to normal
results keys). Footer hints updated.
2026-08-14 23:25:37 +02:00
Michel de Graaf 560d803b00 Merge pull request #39 from michel/cleanup-registry-eviction
refactor(client): dedupe peer registration and order eviction by id
2026-08-13 15:48:38 +02:00
Michel de Graaf 2a90619a64 refactor(client): dedupe peer registration and order eviction by id
The registry stored a registration Instant only to pick the eviction
victim, but the actor id is already monotonic per registration and
refreshed at the same moments, so it orders identically. The
register-refuse-fail sequence was also copy-pasted between the ops
loop and the listener; both now call one register_peer_or_fail.
2026-08-13 15:28:36 +02:00
Michel de Graaf a70c657d31 Merge pull request #38 from michel/release-plz-2026-08-13T12-34-56Z
chore: release v14.0.1
2026-08-13 14:54:14 +02:00
Michel de Graaf 4cce8deea0 chore: release v14.0.1 2026-08-13 14:34:57 +02:00
Michel de Graaf 9ff6497824 Merge branch 'develop': peer failure forwarding and thread-flood fixes 2026-08-13 14:31:14 +02:00
Michel de Graaf 0aec53b40a Merge pull request #37 from michel/issue-32-33-thread-flood
fix(client): bound the threads a peer flood can create
2026-08-13 14:30:43 +02:00
Michel de Graaf 492b961766 fix(client): survive the review findings on the thread-flood fix
Review of the capacity work surfaced three real defects and two gaps:

- A peer dribbling bytes re-armed the 10s handshake read timeout on
  every read and held its accept permit forever; 128 such sockets
  wedged the accept loop for good. The handshake now has one deadline
  across all reads, plus a 4 KiB cap on buffered handshake bytes.
- A capacity refusal was logged and swallowed, leaving the refused
  peer's queued downloads stuck until the caller's own timeout. Both
  registration paths now fail those downloads so the caller gets a
  verdict, and the listener only announces PeerConnected when the
  registration actually happened.
- The transfer-claim was undone by the worker thread writing Queued
  back over it; that write is gone, so a replayed TransferResponse
  can no longer start a second writer on the same .part file.
- Offered uploads and queue waiters joined the eviction-protected
  set, and the browse protection window matches the minutes a real
  share listing takes rather than one.

Regression tests: the broker-timeout sweep failing a queued download
end to end, the replay guard observed over a real socket, and the
handshake deadline against a dribbling and an oversized peer.
2026-08-13 14:10:20 +02:00
Michel de Graaf 9fe1c9984c fix(client): bound the threads a peer flood can create
One popular search produced a ConnectToPeer for every responder, and
each one cost a 2 MiB wrapper thread, an unbounded 256 KiB actor, a
listener thread per inbound socket, and on failure a 2 MiB thread that
slept for 20 seconds. A container with a pids limit died on one album
search (issues #32, #33).

Four bounds, no behavior change for a quiet session:
- P-type registrations run inline on the ops loop; only F transfers
  keep a worker thread. The dial already ran on the actor thread.
- The broker timeout is a deadline swept by the ops loop instead of a
  sleeping thread per failed dial.
- The registry caps live actors (default 512, Client::set_max_peers).
  At capacity the oldest peer outside the caller's protected set
  (live downloads, uploads, pending serves, queued messages, browses
  in flight) is evicted; if none qualify the registration is refused
  before any thread is spawned.
- Concurrent listener handshakes are bounded by a 128-permit
  semaphore released once the peer-init arrives, so slow handshakes
  cannot multiply threads while transfers stay unthrottled.

A replayed TransferResponse for an InProgress or Completed token is
dropped instead of starting a second transfer thread over the same
.part file.

Fixes #32
Fixes #33
2026-08-13 13:46:18 +02:00
Michel de Graaf fd1d168ca6 Merge pull request #36 from michel/issue-29-upload-denied
fix(peer): handle UploadDenied so refused downloads fail fast
2026-08-13 13:26:52 +02:00
Michel de Graaf ba4dc3b1ba Merge pull request #35 from michel/issue-30-upload-failed-forward
fix(peer): forward UploadFailed to the download store
2026-08-13 13:01:51 +02:00
Michel de Graaf 9ce0a851dc fix(peer): handle UploadDenied so refused downloads fail fast
Peer message code 50 had no handler, so the dispatcher dropped it and a
download refused by the peer stayed Queued until the caller's timeout.

The new handler reads the filename and reason and routes the denial into
the same failure path as UploadFailed. A reason of "Queued" is status,
not a failure: some clients send it for a download that is still held in
their queue, and failing it would kill healthy downloads after a
reconnect, so that one is only logged.

Fixes #29
2026-08-13 12:45:57 +02:00
Michel de Graaf 1a4bc52cdf Merge pull request #34 from michel/issue-31-disconnect-state
fix(actor): leave Disconnected state behind after every disconnect
2026-08-13 12:41:12 +02:00
Michel de Graaf d30ca757bc fix(peer): forward UploadFailed to the download store
The code 46 handler parsed the filename and only logged it, so a queued
download whose peer reported an upload failure never received
DownloadStatus::Failed and hung until the caller's own timeout.

The handler now sends PeerMessage::UploadFailed through the dispatcher
and the actor stamps the peer's username on it before forwarding
ClientOperation::UploadFailed into the existing failure path. The
variant's username field stays for API compatibility; the wire message
cannot name anyone but the connected peer, so the actor supplies it.

Fixes #30
2026-08-13 12:39:42 +02:00
Michel de Graaf 77f36b1e98 fix(actor): leave Disconnected state behind after every disconnect
A failed outbound dial left PeerActor in Connecting, so
check_connection_status re-fired the 20-second timeout error on every
100ms tick until the actor was stopped. ServerActor had the same bug:
its disconnect paths only cleared state when already Connected.

Reset connection_state to Disconnected in all four disconnect paths.

Fixes #31
2026-08-13 12:21:14 +02:00
Michel de Graaf a720591ed9 Merge pull request #28 from michel/release-plz-2026-08-10T07-14-20Z
chore: release v14.0.0
2026-08-10 10:05:23 +02:00
Michel de Graaf c2e10beee4 chore: release v13.0.1 2026-08-10 09:32:56 +02:00
Michel de Graaf f24a7f6369 Merge branch 'develop': fd-exhaustion fixes 2026-08-10 09:22:50 +02:00
Michel de Graaf b8cdb2c3fe Merge pull request #27 from michel/slow-tui-daemon
fix: keep an attached TUI fast after a search
2026-08-10 09:12:51 +02:00
Michel de Graaf 6eaf33fbaa fix(lib): cap what a search collects
Counting cheaply was not enough: on the live network peers answer a
popular query for minutes after the window closes, and nothing ever
stopped the pile-up. One 'aphex twin' search grew to 867,990 files and
2.1 GB of daemon memory, and a single search.results reply serialized
134 MB of JSON over 104 seconds - an attached TUI that touched the
search froze for minutes, which read as the whole application being
forever slow.

A search now stops collecting at 500 responses or 10,000 files,
whichever comes first, the same shortlist stance other clients take: a
result set is something to pick from, not an archive of everyone who
answered. The same search now plateaus at ~10k files, a 1.55 MB reply
in 23 ms, and 231 MB of daemon memory; the attached TUI idles at zero
CPU with the search open.
2026-08-09 22:49:56 +02:00
Michel de Graaf 0bbb559f68 fix: survive busy sessions without exhausting file descriptors
The peer listener died with "Too many open files (os error 24)" on any
long-lived non-daemon session: only the daemon raised RLIMIT_NOFILE, and
peer sockets were unbounded — no idle reaping, no deadlines on accepted
transfer streams, and one peer could hold two connections under split
registry identities.

- raise the open-file limit at the top of run(), for every entry point,
  and warn from Client::connect when the soft limit is below 1024
- reap peer control connections idle for five minutes; a clean
  disconnect no longer discards the peer's queued uploads
- give listener-supplied download streams and upload serving the same
  read/write deadlines dialled sockets already had
- register inbound peers under their plain username so the registry
  holds one connection per peer, and announce them like pierced ones
- hold the registry lock across actor spawn + insert and surface
  thread-spawn failure, so an instantly-dead peer cannot leave a
  zombie entry
2026-08-09 22:34:36 +02:00
Michel de Graaf 1551fbbf1b perf(daemon): answer search polls with counts instead of copies
A CLI one-off search leaves its result set in the daemon until someone
forgets it, and an attached TUI made that permanent state expensive:
every 100ms tick asked for the search list twice, and each answer
deep-cloned every result of every search under the context lock just to
sum file counts - stalling the thread that stores incoming results.
Worse, any active or selected search pulled its entire result set over
the socket again each tick, megabytes of JSON repeating what the window
already held.

search.list is now backed by search_file_counts, a walk of the cache
instead of a copy of it; the TUI syncs once per tick and re-fetches a
result set only when the session's file count differs from what it
holds. get_search_results_count reads the same summary, so get --pick
first against a daemon polls a count instead of the full set, and both
session kinds now count files where the local one counted peer
responses.
2026-08-09 22:16:27 +02:00
Michel de Graaf d11326f149 fix(daemon): ship the OpenRPC document inside the crate
docs/openrpc.json lived at the repository root, outside the soulseek-rs
package, so the include_str! in proto compiled from a checkout but not
from the published tarball - cargo publish failed verification and the
v13.0.0 release stopped after publishing the lib. The document moves
into the crate's own docs/, where packaging can see it; the generator
test and every link follow.
2026-07-29 17:34:29 +02:00
Michel de Graaf 881b124b7d ci: give the e2e job the 30 minutes two CLI passes need
The daemon-mode pass repeats the whole CLI suite single-threaded at
about eight minutes per pass, and the job has been cancelled at the
15-minute mark on every master push since it landed - which is what
kept the v13.0.0 release gate shut.
2026-07-29 17:02:35 +02:00
Michel de Graaf d30e863fae test(e2e): hand the serve test's share to the daemon, not the run
The serving process built its arguments by hand, so in daemon mode
--shared-dir stayed on the attached run, where shares belong to the
daemon and the flag is ignored. The daemon fell back to sharing its
default folder - which on a developer machine contains the probe files
earlier buggy runs deposited, so the test only passed by finding
served.bin in leftovers. args_with routes the share to the process
whose session does the sharing in either mode.
2026-07-29 17:02:35 +02:00
Michel de Graaf f525984a7b fix(lib): keep a missing download directory as the target, not its parent
resolve_download_path treated "not a directory" as "names a file" and
fell back to the parent, so a directory that simply did not exist yet
redirected the transfer one level up. The CLI and TUI create the folder
before downloading and never hit it; a daemon does not, so its transfers
landed in ~/Downloads while daemon.status - and the paths download and
get report - named ~/Downloads/Soulseek. Green on any machine where the
folder already exists, which is how it survived to CI.

Only an existing file diverts to the parent now. PartFile::open already
creates the directory it streams into.
2026-07-29 17:02:27 +02:00