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
This commit is contained in:
Michel de Graaf
2026-08-17 09:22:03 +02:00
parent 8128a4cbec
commit 543e9ee865
3 changed files with 124 additions and 22 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
use crate::message::{Message, handlers::Handlers};
use std::sync::mpsc::Sender;
use crate::warn;
use crate::debug;
pub struct MessageDispatcher<Op> {
owner_name: String,
@@ -30,7 +30,7 @@ impl<Op> MessageDispatcher<Op> {
message.set_pointer(8);
handler.handle(message, self.sender.clone());
} else {
warn!(
debug!(
"[{}:dispatcher] No handler found for message code: {code}",
self.owner_name
);