Skip to main content

Module session_manager

Module session_manager 

Source
Expand description

Peer session lifecycle management with per-peer caps, state machine, and idle eviction.

This module provides PeerSessionManager, which tracks active sessions per peer, manages session lifecycle state transitions, enforces per-peer session caps, and applies global idle timeouts based on logical tick counts rather than wall-clock time.

§Session Lifecycle

Initiated → Established → Closing → Closed
    ↓                        ↑
    └────────────────────────┘  (idle eviction marks Closed directly)

§Example

use ipfrs_network::session_manager::{
    PeerSessionManager, SessionManagerConfig, SessionDirection,
};

let config = SessionManagerConfig::default();
let mut mgr = PeerSessionManager::new(config);

let sid = mgr
    .open_session("peer-alpha", SessionDirection::Inbound, 0)
    .expect("open session");

assert!(mgr.get_session(sid).is_some());

Structs§

PeerSessionEntry
A single tracked peer session.
PeerSessionManager
Manages the lifecycle of peer sessions with per-peer caps and idle eviction.
SessionManagerConfig
Configuration for PeerSessionManager.
SessionManagerStats
Aggregated statistics snapshot for PeerSessionManager.

Enums§

PeerSessionState
Lifecycle state of a single peer session.
SessionDirection
Direction in which a session was initiated.

Type Aliases§

PeerSession
Public alias for PeerSessionEntry matching the required API surface.
SessionState
Public alias for PeerSessionState matching the required API surface.