Skip to main content

background_loop

Function background_loop 

Source
pub async fn background_loop(
    receiver: UnboundedReceiver<(UnboundedSender<Response>, Command)>,
    session: Arc<Session>,
)
Expand description

The per-session command dispatcher.

Receives (reply_sender, command) pairs from the session’s mpsc receiver and processes them serially against the session’s in-memory state (open packs, dependency cache, schema, settings cache, per-pack OperationalMode). For each command, the matching handler computes the response (often several responses for multi-stage operations) and ships them back through reply_sender.

One instance runs per Session, spawned by Session::new. The loop terminates when the session is dropped or Command::Exit is dispatched.

No UI or unsafe work happens here — everything is plain async Rust on top of rpfm_lib and rpfm_extensions.