refactor (Opus 4.5): modularize and split
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
//! Configuration constants for the peer system.
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
/// Interval between peer ping checks (seconds).
|
||||
pub const PEER_PING_INTERVAL_SECS: u64 = 5;
|
||||
|
||||
/// Timeout after which a peer is considered stale (seconds).
|
||||
pub const PEER_STALE_TIMEOUT_SECS: u64 = 12;
|
||||
|
||||
/// Size of each download chunk (32 MB).
|
||||
pub const CHUNK_SIZE: u64 = 32 * 1024 * 1024;
|
||||
|
||||
/// Maximum number of retry attempts for failed chunk downloads.
|
||||
pub const MAX_RETRY_COUNT: usize = 3;
|
||||
|
||||
/// Interval for local game directory monitoring (seconds).
|
||||
pub const LOCAL_GAME_MONITOR_INTERVAL_SECS: u64 = 5;
|
||||
|
||||
/// TLS certificate for QUIC connections.
|
||||
pub static CERT_PEM: &str = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../cert.pem"));
|
||||
|
||||
/// TLS private key for QUIC connections.
|
||||
pub static KEY_PEM: &str = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../key.pem"));
|
||||
|
||||
/// Returns the peer stale timeout as a Duration.
|
||||
#[must_use]
|
||||
pub fn peer_stale_timeout() -> Duration {
|
||||
Duration::from_secs(PEER_STALE_TIMEOUT_SECS)
|
||||
}
|
||||
Reference in New Issue
Block a user