tsclientlib: fail refused file transfers on their handle

A server refuses ftinitdownload/ftinitupload (file not found, missing
permission, quota) with an error for the command's return code. The
library turned that into a MessageResult whose handle the caller never
saw, so a refused transfer just hung. The pending transfer commands are
now remembered by return code and a refusal fails the transfer with
FiletransferFailed.

A server listening on all interfaces may announce 0.0.0.0 as the
transfer address; the server's own address is used then. The return
code and transfer id counters wrap instead of panicking on overflow in
debug builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
This commit is contained in:
Claude committed 2026-09-28 19:22:05 +00:00
1 parent 2e034bc7b5
commit 7569e5a009
2 files changed
+36 -8

No files matched your search

+7
View File
@@ -67,3 +67,10 @@ against or offered back to upstream.
required `reason`; `notifyjoinstreamrequest` carries `is_remove`,
`notifystreamstopped` and `notifystreamclientleft` carry `reason`, the latter also
`return_code`.
8. **File transfer fixes** (`tsclientlib/src/lib.rs`, marked "Voelin patch").
A server that refuses `ftinitdownload`/`ftinitupload` (file not found, no
permission, quota) answers with an `error` for the command's return code, which
came out as a `MessageResult` the caller cannot match to its
`FiletransferHandle`; it now fails the transfer (`FiletransferFailed`). A
transfer address of `0.0.0.0`/`::` means the server's own address. The return
code and transfer id counters wrap instead of overflowing.