Skip to main content

Module session_scope

Module session_scope 

Source
Expand description

Per-session state shared across the channels bound to one session ([MS-SMB2] §3.3.5.5.3 multichannel): the Session.TreeConnectTable and Session.OpenTable ([MS-SMB2] §3.3.1.8).

The server runs on a single tokio_uring thread, so channels share this state through a thread-local registry of Rc<RefCell<SessionScope>> keyed by session id. This avoids a Send/Sync bound — io_uring open handles are !Send — and needs no cross-thread locking.

Handlers must never hold a RefCell borrow across an .await; async file I/O checks an OpenFile out of the map, awaits on the owned value, then checks it back in (see Smb2Conn helpers).

Structs§

ChannelSeq
Per-open channel-sequence counters ([MS-SMB2] §3.3.5.2.10).
SessionScope
State shared by every channel bound to one session.

Constants§

SCOPES 🔒

Functions§

detached
Create a fresh, unregistered scope. A new connection starts with one so pre-session state is isolated; session setup replaces it with the session’s shared scope from the registry.
get_or_create
Return the scope for session_id, creating and registering it if absent. The first channel of a session creates it; a binding channel reuses it.
remove
Drop the scope when the session is torn down (LOGOFF or last channel gone).

Type Aliases§

ScopeRef
Shared, per-thread handle to a session’s SessionScope.