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:
@@ -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!();
|
||||
|
||||
Reference in New Issue
Block a user