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
+2 -1
View File
@@ -5,7 +5,7 @@ use crate::message::peer::{
FileSearchResponse, GetShareFileList, PeerInit, PlaceInQueueRequest,
PlaceInQueueResponse, QueueUploadHandler, SharedDirectory,
SharedFileListResponseHandler, TransferRequest, TransferResponse,
UploadFailedHandler,
UploadDeniedHandler, UploadFailedHandler,
};
use crate::message::server::MessageFactory;
use crate::message::{Handlers, Message, MessageReader, MessageType};
@@ -178,6 +178,7 @@ impl PeerActor {
handlers.register_handler(TransferRequest);
handlers.register_handler(TransferResponse);
handlers.register_handler(GetShareFileList);
handlers.register_handler(UploadDeniedHandler);
handlers.register_handler(UploadFailedHandler);
handlers.register_handler(PlaceInQueueRequest);
handlers.register_handler(PlaceInQueueResponse);