From 4ccd20299be94e69d5be02650152565f3f64cc85 Mon Sep 17 00:00:00 2001 From: Danny Kim Date: Sat, 26 Sep 2026 01:54:31 +0900 Subject: [PATCH] Explain why the session lives in a per-instance slot --- src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 8dc8806..426f1aa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,6 +32,10 @@ struct Session { signer: Signer, } +// The host creates one component instance per connection and calls into it +// on a single thread, so this slot holds exactly one connection's session and +// is not shared state between connections. A WASI component has no other place +// to keep state between exported calls. thread_local! { static SESSION: RefCell> = const { RefCell::new(None) }; }