Skip to main content

run_session

Function run_session 

Source
pub async fn run_session<S, R, W>(
    store: &mut S,
    send: W,
    recv: R,
) -> Result<SessionReport, SessionError>
where S: SyncStore, R: AsyncRead + Unpin, W: AsyncWrite + Unpin,
Expand description

Run one session to completion over send/recv, syncing account entries with the peer.

Both halves run under join! on the current task — no spawn, so store (and its SQLite connection) need not be Send. The sender owns an up-front snapshot of local entries; the receiver holds &mut store to ingest. Because the sender reads only the snapshot, the two never alias the store.