Explain why the session lives in a per-instance slot
This commit is contained in:
@@ -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<Option<Session>> = const { RefCell::new(None) };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user