From f637959ba7fa7214e8552719fe0f095296906e07 Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Fri, 6 Dec 2024 00:08:11 +0000 Subject: [PATCH] Group session fields + add comments (Claude) --- crates/librqbit/src/session.rs | 38 ++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/crates/librqbit/src/session.rs b/crates/librqbit/src/session.rs index 1a569f0..cffc43e 100644 --- a/crates/librqbit/src/session.rs +++ b/crates/librqbit/src/session.rs @@ -97,39 +97,41 @@ impl SessionDatabase { } pub struct Session { - peer_id: Id20, - dht: Option, - persistence: Option>, - pub(crate) bitv_factory: Arc, - peer_opts: PeerConnectionOptions, - spawner: BlockingSpawner, + // Core state and services + pub(crate) db: RwLock, next_id: AtomicUsize, - db: RwLock, - output_folder: PathBuf, + pub(crate) bitv_factory: Arc, + spawner: BlockingSpawner, + // Network + peer_id: Id20, tcp_listen_port: Option, + dht: Option, + pub(crate) connector: Arc, + reqwest_client: reqwest::Client, + // Lifecycle management cancellation_token: CancellationToken, + _cancellation_token_drop_guard: DropGuard, + // Runtime settings + output_folder: PathBuf, + peer_opts: PeerConnectionOptions, + default_storage_factory: Option, + persistence: Option>, disk_write_tx: Option, - default_storage_factory: Option, - - reqwest_client: reqwest::Client, - pub(crate) connector: Arc, + // Limits and throttling pub(crate) concurrent_initialize_semaphore: Arc, - - root_span: Option, - pub(crate) ratelimits: Limits, + // Monitoring / tracing / logging pub(crate) stats: SessionStats, + root_span: Option, + // Feature flags #[cfg(feature = "disable-upload")] _disable_upload: bool, - - // This is stored for all tasks to stop when session is dropped. - _cancellation_token_drop_guard: DropGuard, } async fn torrent_from_url(