1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//! BT Message Handler - Block request and receive logic
//!
//! This module handles the low-level BitTorrent protocol message processing
//! for block requests and data reception during piece download.
//!
//! Extracted from `bt_download_command.rs` to improve modularity and
//! follow the single responsibility principle.
//!
//! # Architecture Reference
//!
//! Based on original aria2 C++ structure:
//! - `src/DefaultBtMessageDispatcher.h` - Message queue + request slots
//! - `src/DefaultBtInteractive.h` - Per-peer interaction loop
//! - `src/PeerInteractionCommand.h` - Peer interaction
//!
//! # Module Structure
//!
//! - [`BtPeerMessageHandler`] — Per-peer stateful handler wrapping a
//! [`BtMessageDispatcher`](crate::engine::bt_message_dispatcher::BtMessageDispatcher)
//! with event-driven actions, flooding detection, and request slot tracking.
//! Mirrors C++ `DefaultBtInteractive`.
//! - [`BtMessageHandler`] — Legacy stateless block request/receive utilities
//! (kept for backward compatibility; prefer `BtPeerMessageHandler`).
// Public re-exports — all public items remain accessible from `bt_message_handler::`
pub use BtMessageHandler;
pub use BtPeerMessageHandler;
pub use ;