Skip to main content

Module bt_message_handler

Module bt_message_handler 

Source
Expand description

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/BtMessageDispatcher.h - Message dispatching
  • src/PeerInteractionCommand.h - Peer interaction

Structs§

BlockDownloadResult
Result of a block download attempt
BtMessageHandler
BT Message Handler for block-level operations

Constants§

BLOCK_REQUEST_TIMEOUT_SECS
Timeout for each block request (seconds)
BLOCK_SIZE
Block size for each piece block request (16 KB)
MAX_BLOCK_READ_MESSAGES
Maximum messages to read while waiting for a specific block
MAX_RETRIES
Maximum number of retries for a failed piece download