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
This commit is contained in:
Michel de Graaf
2026-08-13 12:45:57 +02:00
parent d30ca757bc
commit 9ce0a851dc
4 changed files with 72 additions and 1 deletions
+12
View File
@@ -859,6 +859,18 @@ fn an_upload_failed_reply_fails_the_download_quickly() {
});
}
#[test]
fn an_upload_denied_reply_fails_the_download_quickly() {
refusal_fails_the_download_quickly("e2e_denying_peer", |filename| {
let mut refusal = Message::new();
refusal
.write_int32(50)
.write_string(filename)
.write_string("File not shared.");
refusal
});
}
#[test]
fn an_interrupted_download_resumes_from_its_partial_file() {
let server = server_or_skip!();